Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
Auto-deploy (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturner authored Sep 9, 2023
1 parent 86b8eba commit 8ba871a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy

on:
release:
types: [created]

jobs:
deploy_source:
name: Build and Deploy
strategy:
matrix:
node-version: [16.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- run: echo -e '//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}'$'\n'"$(cat .npmrc)" > .npmrc
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_READ }}

- run: npm version --git-tag-version false ${{github.event.release.tag_name}}

- run: npm run build --if-present
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_READ }}

- name: Create package
uses: montudor/action-zip@v0.1.0
with:
args: zip -qq -r ./bundle.zip ./

- name: Deploy
uses: appleboy/lambda-action@master
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: eu-west-1
function_name: Salus
zip_file: bundle.zip
3 changes: 3 additions & 0 deletions aws/legacy-lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ const Factory = require('@matthewturner/smartheat-core/core/Factory');
module.change_code = 0;

let app = new alexa.app('boiler');
const { version } = require('../package.json');

const controlService = (request, serviceType = ThermostatService, logger = new Logger(process.env.LOG_LEVEL || Logger.DEBUG)) => {
logger.debug(`SmartHome Version: ${version}`);

const userId = request.userId || request.data.session.user.userId;
const shortUserId = helpers.truncateUserId(userId);
logger.prefix = shortUserId;
Expand Down

0 comments on commit 8ba871a

Please sign in to comment.