Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Latest commit
51 lines (44 loc) · 1.5 KB
/
Copy pathdeploy_python_lambda.yml
File metadata and controls
51 lines (44 loc) · 1.5 KB
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 python lambda"
on:
workflow_call:
inputs:
lambda_name:
description: "name of the lambda function to deploy - this should already exist on the AWS account through terraform"
required: true
type: string
source_dir:
description: "source directory of the lambda (usually 'src')"
required: true
type: string
aws_role_to_assume:
description: "AWS role ARN to assume for the push - you can find this in the AWS console called ga-${lambda-name}-role"
required: true
type: string
aws_region:
description: "AWS region"
default: "eu-west-1"
type: string
permissions:
id-token: write
contents: read
jobs:
push-lambda:
name: "Push lambda"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- name: Configure AWS access
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ inputs.aws_role_to_assume }}
aws-region: ${{ inputs.aws_region }}
- name: Install dependencies and zip lambda
run: |
cd ${{ inputs.source_dir }}
pip3 install -r requirements.txt --quiet --target .
zip -r ../${{ inputs.lambda_name }}.zip .
- name: Deploy Lambda
run: aws lambda update-function-code --function-name ${{ inputs.lambda_name }} --zip-file fileb://${{ inputs.lambda_name }}.zip