lambda-deploy-commcare-s3-etl-bha-train #1
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-commcare-s3-etl-bha-train | |
on: workflow_dispatch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup AWS CLI | |
uses: aws-actions/configure-aws-credentials@v1 | |
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: Deploy Files | |
run: | | |
S3_BUCKET=lambda-function-deploy-zip | |
S3_KEY=lambda-deploy-data-and-analytics-etl-bha-train.zip | |
LAMBDA_FUNCTION_NAME=commcare-s3-etl-bha-train | |
# the following will only look for .py files in the current dir (no folder) | |
zip -r updated_lambda.zip *.py | |
# Upload the updated zip to S3 | |
aws s3 cp updated_lambda.zip s3://$S3_BUCKET/$S3_KEY | |
# Update Lambda function code | |
aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME --s3-bucket $S3_BUCKET --s3-key $S3_KEY | |
# Cleanup | |
rm updated_lambda.zip |