Skip to content

Commit

Permalink
ci: add deploy lambda.
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney authored Dec 28, 2023
2 parents 3bd8ecd + 5d6067c commit 2fceb3d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
ci:
Expand All @@ -29,3 +29,14 @@ jobs:
path: npm-debug.log
- name: Build
run: npm run build
- name: Zip
run: npm run zip
- name: AWS Lambda Deploy
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_REGION }}
function_name: restbus
zip_file: dist/restbus.zip
dry_run: true
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy

on:
workflow_dispatch:

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: '20.10.0'
- name: Install Dependencies
run: npm ci
- name: Save error log
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: npm-debug-log-${{ hashFiles('package-lock.json') }}
path: npm-debug.log
- name: Build
run: npm run build
- name: Zip
run: npm run zip
- name: AWS Lambda Deploy
uses: appleboy/[email protected]
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_REGION }}
function_name: restbus
zip_file: dist/restbus.zip
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"prettier": "prettier -w .",
"start": "node index.js run",
"dev": "node --watch index.js run",
"build": "NODE_ENV=production webpack"
"build": "NODE_ENV=production webpack",
"zip": "cd dist && zip restbus.zip index.js"
},
"prettier": {
"arrowParens": "avoid",
Expand Down

0 comments on commit 2fceb3d

Please sign in to comment.