Skip to content

Merge pull request #602 from Marukome0743/pr602 #382

Merge pull request #602 from Marukome0743/pr602

Merge pull request #602 from Marukome0743/pr602 #382

Workflow file for this run

name: Lambda CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: main
paths:
- "app/**"
- "public/**"
- "bun.lockb"
- "package.json"
- "*config.*"
workflow_dispatch:
env:
AWS_REGION: ap-northeast-1
ECR_REPOSITORY: caravan-kidstec
LAMBDA_FUNCTION_NAME: caravan-kidstec
jobs:
lambda:
runs-on: ubuntu-24.04
if: github.repository_owner == 'openup-labtakizawa'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm64
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
- name: Update Lambda Function
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME \
--architectures arm64 --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG