Add test and deploy workflows #3
Workflow file for this run
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: deploy | |
on: | |
push: | |
branches: | |
- development | |
- base | |
pull_request: | |
branches: | |
- development | |
jobs: | |
deploy: | |
#if: github.ref == 'refs/heads/base' || github.ref == 'refs/heads/development' | |
runs-on: ubuntu-latest | |
environment: | |
name: development | |
env: | |
LAMBDA_NAME: digitized_av_notifications | |
LAMBDA_HANDLER_CODE: src/handle_digitized_av_notifications.py | |
BASENAME: handle_digitized_av_notifications.py | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Export secrets to environment variables | |
uses: oNaiPs/[email protected] | |
with: | |
secrets: ${{ toJSON(secrets) }} | |
- name: Make zip file | |
run: | | |
cp ${{ env.LAMBDA_HANDLER_CODE }} ${{ env.BASENAME }} | |
zip ${{ env.LAMBDA_NAME }}.zip ${{ env.BASENAME }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Upload file to S3 | |
run: aws s3 cp $LAMBDA_NAME.zip s3://$LAMBDA_BUCKET_NAME/$LAMBDA_NAME.zip | |
- name: Deploy lambda package | |
run: aws lambda update-function-code | |
--function-name arn:aws:lambda:$AWS_REGION:$AWS_LAMBDA_ACCOUNT_ID:function:$LAMBDA_NAME | |
--zip-file fileb://$LAMBDA_NAME.zip |