Skip to content

chore: changed lambda-2 to test deployment #7

chore: changed lambda-2 to test deployment

chore: changed lambda-2 to test deployment #7

Workflow file for this run

name : lambda-deploy
on:
push:
branches:
- dev
- qa
jobs:
lambda-deploy-all:
strategy:
matrix:
label: [lambda-1, lambda-2]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
role-to-assume: arn:aws:iam::949263681218:role/ankit-oidc-role
aws-region: us-east-1
- name: Set stage
run: |
if [[ $GITHUB_REF == refs/heads/dev ]]; then
echo "export STAGE=dev" >> $GITHUB_ENV
elif [[ $GITHUB_REF == refs/heads/qa ]]; then
echo "export STAGE=qa" >> $GITHUB_ENV
fi
- name: Check for changes in lambda directory
id: lambda-changed
run: |
cd ${{ matrix.label }}
if grep -q "${{ matrix.label }}" <(git diff --name-only HEAD~1 HEAD); then
echo "change=Changes detected" >> $GITHUB_OUTPUT
fi
- name: Deploy lambda
if: steps.lambda-changed.outputs.change == 'Changes detected'
run: |
cd ${{ matrix.label }}
zip -r lambda_zip.zip *
aws lambda update-function-code --function-name "${{ matrix.label }}-$STAGE" --zip-file fileb://./lambda_zip.zip