Skip to content

Merge pull request #148 from OpenUp-LabTakizawa/dependabot/npm_and_ya… #13

Merge pull request #148 from OpenUp-LabTakizawa/dependabot/npm_and_ya…

Merge pull request #148 from OpenUp-LabTakizawa/dependabot/npm_and_ya… #13

Workflow file for this run

name: Deploy to Amazon Lambda
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- "app/**"
- "public/**"
- "bun.lockb"
- "package.json"
- "yarn.lock"
- "*config.*"
workflow_dispatch:
env:
AWS_REGION: ap-northeast-1
ECR_REPOSITORY: homepage
LAMBDA_FUNCTION_NAME: homepage
jobs:
deploy:
if: github.repository == 'OpenUp-LabTakizawa/homepage'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG