-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.52 KB
/
deploy-ruby-lambda-function.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
52
name: Deploy to Ruby Lambda Function
on:
push:
branches:
- "main"
- "master"
paths:
- 'rb-function/**'
workflow_dispatch:
env:
AWS_REGION: eu-central-1
LAMBDA_FUNCTION_NAME: 'secretsmanager-lambda-example-rb-lambda-function'
ASSUME_ROLE: 'SkroutzSecretExampleLambdaDeployerRole'
permissions:
contents: read
jobs:
deploy-lambda-function:
name: Deploy Lambda Function
runs-on: ubuntu-latest
environment: production
steps:
- name: 'Checkout Source Code'
uses: actions/checkout@v1
- name: Configure AWS Credentials
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: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.ASSUME_ROLE }}
role-duration-seconds: 900
- name: Zip Function Artifacts
env:
release_id: ${{ format('aws-secretsmanager-lambda-example-{0}-function.zip', github.head_ref )}}
run: |
mkdir build
cd ./rb-function
zip -r ../build/$release_id ./*
cd ..
- name: Deploy Lambda Function
env:
release_id: ${{ format('aws-secretsmanager-lambda-example-{0}-function.zip', github.head_ref )}}
run: |
aws lambda update-function-code --function-name "${LAMBDA_FUNCTION_NAME}" --architectures x86_64 arm64 --zip-file fileb://build/$release_id
rm -r ./build