forked from openhab/openhab-google-assistant
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add-deployment' into dev
Signed-off-by: Michael Krug <[email protected]>
- Loading branch information
Showing
11 changed files
with
82 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name-template: '$RESOLVED_VERSION' | ||
tag-template: '$RESOLVED_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- title: '🧰 Maintenance' | ||
labels: | ||
- 'maintenance' | ||
- 'dependencies' | ||
template: | | ||
## Changes | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,11 @@ name: CI/CD | |
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ v* ] | ||
tags: [ "*" ] | ||
pull_request: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
unit-testing: | ||
|
@@ -36,12 +38,6 @@ jobs: | |
name: coverage | ||
path: coverage/ | ||
|
||
- name: Comment Test Coverage | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: romeovs/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
code-analysis: | ||
name: Code Analysis | ||
runs-on: ubuntu-latest | ||
|
@@ -59,7 +55,7 @@ jobs: | |
uses: github/codeql-action/analyze@v1 | ||
|
||
deployment: | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release' | ||
name: Install and Deploy | ||
runs-on: ubuntu-latest | ||
needs: [unit-testing, code-analysis] | ||
|
@@ -81,7 +77,7 @@ jobs: | |
uses: google-github-actions/deploy-cloud-functions@main | ||
with: | ||
credentials: ${{ secrets.GCP_SA_KEY }} | ||
name: openhab-google-assistant | ||
name: ${{ github.event_name == 'release' && 'openhabGoogleAssistant_prod' || 'openhabGoogleAssistant_test' }} | ||
runtime: nodejs12 | ||
source_dir: ./functions | ||
entry_point: openhabGoogleAssistant | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Draft Release | ||
|
||
on: | ||
push: | ||
tags: [ "*" ] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Draft Release | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,8 @@ | |
* | ||
**/ | ||
module.exports = { | ||
//userpass: '[email protected]:Password1', | ||
host: '<YOUR-CLOUD-HOST>', | ||
port: 443, | ||
path: '/YOUR/REST/ENDPOINT' | ||
//userpass: process.env.OH_USERPASS || '[email protected]:Password1', | ||
host: process.env.OH_HOST || '<YOUR-CLOUD-HOST>', | ||
port: process.env.OH_PORT || 443, | ||
path: process.env.OH_PATH || '/YOUR/REST/ENDPOINT' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
const express = require('express'); | ||
const app = express(); | ||
const bodyParser = require('body-parser'); | ||
const openhabGA = require('./functions/index.js'); | ||
|
||
app.use(bodyParser.json()); | ||
app.use(express.json()); | ||
|
||
app.use('/', (req, res) => { | ||
openhabGA.openhabGoogleAssistant(req, res); | ||
}); | ||
|
||
app.listen(3000, () => { | ||
console.log('Server is listening on port 3000'); | ||
const port = process.env.OH_SERVER_PORT || 3000; | ||
app.listen(port, () => { | ||
console.log('Server is listening on port %s', port); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
const Config = require('../functions/config.js'); | ||
|
||
describe('Config', () => { | ||
test('Config all properties', () => { | ||
test('All properties available', () => { | ||
expect(Object.keys(Config)).toStrictEqual(['host', 'port', 'path']); | ||
}); | ||
|
||
test('Properties used from ENV', () => { | ||
expect(Config.host).toBe('test.host'); | ||
expect(Config.port).toBe('1234'); | ||
expect(Config.path).toBe('/test/items'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
process.env.OH_HOST = 'test.host'; | ||
process.env.OH_PORT = '1234'; | ||
process.env.OH_PATH = '/test/items'; |