Update workflow and lambda1 #10
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 : lambda-deploy | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
- qa | ||
env: | ||
change_flag: false | ||
jobs: | ||
check-for-change: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: Check for changes in lambda-1 | ||
id: lambda-1 | ||
uses: yumemi-inc/path-filter@v2 | ||
with: | ||
patterns: 'lambda-1/**' | ||
run: | | ||
echo "change_list=lambda-1" >> $GITHUB_ENV | ||
echo "change_flag=true" >> $GITHUB_ENV | ||
- name: Check for changes in lambda-2 | ||
id: lambda-2 | ||
uses: yumemi-inc/path-filter@v2 | ||
with: | ||
patterns: 'lambda-2/**' | ||
run: | | ||
change_list = "${change_list}|lambda-2" | ||
echo "change_flag=true" >> $GITHUB_ENV | ||
lambda-deploy-all: | ||
needs: [check-for-change] | ||
if: env.change_flag == 'true' | ||
strategy: | ||
matrix: | ||
label: ${{ env.change_list }} | ||
Check failure on line 38 in .github/workflows/main.yml
|
||
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 "STAGE=dev" >> $GITHUB_ENV | ||
elif [[ $GITHUB_REF == refs/heads/qa ]]; then | ||
echo "STAGE=qa" >> $GITHUB_ENV | ||
fi | ||
- name: Deploy lambda | ||
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 |