Skip to content

Commit

Permalink
break Lambda deployment into a separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Feb 26, 2024
1 parent 2031a81 commit 7cab886
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy

on:
push:
branches: [main, develop]

jobs:
deploy:
name: Deploy to AWS Lambda
needs: tests
runs-on: ubuntu-latest
env:
AWS_REGION: ${{ vars.AWS_REGION }}
STG_AWS_ACCESS_KEY_ID: ${{ vars.STG_AWS_ACCESS_KEY_ID }}
STG_AWS_SECRET_ACCESS_KEY: ${{ secrets.STG_AWS_SECRET_ACCESS_KEY }}
STG_LAMBDA_ROLE: ${{ vars.STG_LAMBDA_ROLE }}
STG_API_KEY_TABLE: ${{ vars.STG_API_KEY_TABLE }}
STG_WEBAUTHN_TABLE: ${{ vars.STG_WEBAUTHN_TABLE }}
PRD_AWS_ACCESS_KEY_ID: ${{ vars.PRD_AWS_ACCESS_KEY_ID }}
PRD_AWS_SECRET_ACCESS_KEY: ${{ secrets.PRD_AWS_SECRET_ACCESS_KEY }}
PRD_LAMBDA_ROLE: ${{ vars.PRD_LAMBDA_ROLE }}
PRD_API_KEY_TABLE: ${{ vars.PRD_API_KEY_TABLE }}
PRD_WEBAUTHN_TABLE: ${{ vars.PRD_WEBAUTHN_TABLE }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy
run: docker-compose -f actions-services.yml run --rm app ./scripts/deploy.sh
23 changes: 0 additions & 23 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,6 @@ jobs:
- name: Test
run: docker-compose -f actions-services.yml run --rm test ./scripts/test.sh

deploy:
name: Deploy to AWS Lambda
needs: tests
runs-on: ubuntu-latest
env:
AWS_REGION: ${{ vars.AWS_REGION }}
STG_AWS_ACCESS_KEY_ID: ${{ vars.STG_AWS_ACCESS_KEY_ID }}
STG_AWS_SECRET_ACCESS_KEY: ${{ secrets.STG_AWS_SECRET_ACCESS_KEY }}
STG_LAMBDA_ROLE: ${{ vars.STG_LAMBDA_ROLE }}
STG_API_KEY_TABLE: ${{ vars.STG_API_KEY_TABLE }}
STG_WEBAUTHN_TABLE: ${{ vars.STG_WEBAUTHN_TABLE }}
PRD_AWS_ACCESS_KEY_ID: ${{ vars.PRD_AWS_ACCESS_KEY_ID }}
PRD_AWS_SECRET_ACCESS_KEY: ${{ secrets.PRD_AWS_SECRET_ACCESS_KEY }}
PRD_LAMBDA_ROLE: ${{ vars.PRD_LAMBDA_ROLE }}
PRD_API_KEY_TABLE: ${{ vars.PRD_API_KEY_TABLE }}
PRD_WEBAUTHN_TABLE: ${{ vars.PRD_WEBAUTHN_TABLE }}

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy
run: docker-compose -f actions-services.yml run --rm app ./scripts/deploy.sh

build-and-publish:
name: Build and Publish
needs: tests
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ then
export WEBAUTHN_TABLE="${PRD_WEBAUTHN_TABLE}"
else
echo "deployments only happen from develop and main branches (branch: ${GITHUB_REF_NAME})"
exit
exit 1
fi

# Print the Serverless version in the logs
Expand Down

0 comments on commit 7cab886

Please sign in to comment.