Lambdaへのデプロイを追加 #15
Workflow file for this run
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: cd-staging | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- feature/issue13 | |
env: | |
ECR_REPOSITORY: stg-lgtm-image-processor | |
FUNCTION_NAME: stg-lgtm-image-processor | |
jobs: | |
build: | |
name: Build Docker Image and Deploy to Lambda to Staging | |
timeout-minutes: 15 | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }} | |
aws-region: "ap-northeast-1" | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }} | |
tags: type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
provenance: false | |
tags: ${{ steps.meta.outputs.tags }} | |
platforms: linux/arm64 | |
- name: Deploy to Lambda | |
uses: aws-actions/aws-codebuild-run-build@v1 | |
with: | |
project-name: lgtm-cat-processor-deploy-test | |
hide-cloudwatch-logs: true | |
env-vars-for-codebuild: | | |
IMAGE_URI, | |
FUNCTION_NAME | |
env: | |
IMAGE_URI: ${{ steps.meta.outputs.tags }} | |
FUNCTION_NAME: ${{ env.FUNCTION_NAME }} |