Merge pull request #136 from willsawyerrrr/dependabot/npm_and_yarn/ty… #146
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
name: Deploy to AWS Lambda | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
deploy: | |
environment: deployment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
audience: sts.amazonaws.com | |
aws-region: ap-southeast-2 | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build, tag, and push docker image to Amazon ECR | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -t ${REGISTRY}/multi-gitter-runner:latest -t ${REGISTRY}/multi-gitter-runner:${IMAGE_TAG} . | |
docker push ${REGISTRY}/multi-gitter-runner --all-tags | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- run: npm clean-install | |
- run: npm install --global aws-cdk | |
- run: npx tsc | |
- name: Synthesise and Deploy AWS Stack | |
env: | |
APP_ID: ${{ secrets.APP_ID }} | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
IMAGE_TAG: ${{ github.sha }} | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} | |
run: | | |
cdk synthesize --app "node dist/infrastructure" | |
cdk deploy --app "node dist/infrastructure" --ci true --require-approval never --force true |