Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .github/workflows/deploy-lamda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
- 'MOSIP*'
- 'release*'
paths:
- 'develop/notifier-slackbot/**'
- 'notifier-slackbot/**'
- '.github/workflows/deploy-lamda.yml'

concurrency:
Expand All @@ -30,7 +30,7 @@ jobs:

defaults:
run:
working-directory: develop/notifier-slackbot
working-directory: notifier-slackbot

steps:
- name: Checkout repository
Expand All @@ -40,19 +40,19 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache: npm
cache-dependency-path: notifier-slackbot/package-lock.json

- name: Install dependencies
run: npm ci

- name: Create Lambda deployment package
- name: Zip deployment package
run: |
zip -q -r lambda-deployment.zip \
index.js \
node_modules \
package.json \
package-lock.json \
node_modules
package-lock.json

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
Expand All @@ -66,7 +66,8 @@ jobs:
run: |
aws lambda update-function-code \
--function-name probot-app \
--zip-file fileb://lambda-deployment.zip
--zip-file fileb://lambda-deployment.zip \
--no-cli-pager

- name: Wait for Lambda deployment
run: |
Expand All @@ -79,16 +80,23 @@ jobs:
--function-name probot-app \
--query 'Configuration.State' \
--output text)

echo "Lambda function state: $STATE"

if [ "$STATE" != "Active" ]; then
echo "Error: Lambda function is not in Active state"

UPDATE_STATUS=$(aws lambda get-function \
--function-name probot-app \
--query 'Configuration.LastUpdateStatus' \
--output text)

echo "Lambda State: $STATE"
echo "Lambda LastUpdateStatus: $UPDATE_STATUS"

if [[ "$STATE" != "Active" || "$UPDATE_STATUS" != "Successful" ]]; then
echo "Lambda deployment verification failed"
exit 1
fi

echo "Lambda deployment verified successfully"
aws lambda get-function \
--function-name probot-app \
--query 'Configuration.[FunctionName,LastModified,State]' \
--query 'Configuration.[FunctionName,Runtime,LastModified,State,LastUpdateStatus]' \
--output table
```