Skip to content

feat: migrate lambda deployment #41

feat: migrate lambda deployment

feat: migrate lambda deployment #41

Workflow file for this run

name: Deploy Backend to Preview ECS
on:
push:
branches: ["main"]
paths:
- "server/**"
pull_request:
branches: [ "main" ]
env:
AWS_REGION: ap-northeast-1
ECR_REPOSITORY: petercat-lambda
ECR_REGISTRY: 654654285942.dkr.ecr.ap-northeast-1.amazonaws.com
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build_and_push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::654654285942:role/Github-OIDC
audience: sts.amazonaws.com
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@2fc7aceee09e9e4a7105c0d060c656fad0b4f63d # v1
deploy:
needs: build_and_push
runs-on: ubuntu-latest
environment: production
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::654654285942:role/Github-OIDC
audience: sts.amazonaws.com
aws-region: ${{ env.AWS_REGION }}
# Build inside Docker containers
- run: cd server && sam build --use-container --config-file petercat-preview.toml
# Prevent prompts and failure when the stack is unchanged
- run: cd server && sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --config-file petercat-preview.toml