Skip to content

Update deployment configuration for lambda service #8

Update deployment configuration for lambda service

Update deployment configuration for lambda service #8

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
paths:
- 'demo/lambda/src/**'
-
jobs:
build:
runs-on: ubuntu-latest
name: build docker image
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
- 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: ${{ secrets.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
run: |
cd demo/lambda/src
docker build -t ${{ steps.login-ecr.outputs.registry }}/demo-awscd-2024:$GITHUB_SHA -f Dockerfile .
docker push ${{ steps.login-ecr.outputs.registry }}/demo-awscd-2024:$GITHUB_SHA
- name: Replace the Docker image tag with Git SHA in deploy.yaml
run: |
GIT_SHA=$GITHUB_SHA
sed -i.bak "s#demo-awscd-2024:.*#demo-awscd-2024:$GIT_SHA#g" demo/lambda/deployment/deploy.yaml
- name: Add & Commit changes
uses: EndBug/add-and-commit@v9
with:
message: "Update deploy.yaml with the latest image tag"
add: 'demo/lambda/deployment/deploy.yaml'
default_author: github_actions