-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.51 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Deploy
on:
push:
branches:
- development
- base
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
env:
LAMBDA_NAME: digitized_image_trigger
LAMBDA_HANDLER_CODE: src/handle_digitized_image_trigger.py
BASENAME: handle_digitized_image_trigger.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 }}
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE }}
role-skip-session-tagging: true
role-duration-seconds: 900
- name: Upload file to S3
run: aws s3 cp $LAMBDA_NAME.zip s3://${{ secrets.LAMBDA_BUCKET_NAME }}/$LAMBDA_NAME.zip
- name: Deploy lambda package
run: aws lambda update-function-code
--function-name arn:aws:lambda:${{ secrets.AWS_REGION }}:${{ secrets.AWS_LAMBDA_ACCOUNT_ID }}:function:$LAMBDA_NAME
--zip-file fileb://$LAMBDA_NAME.zip