-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 1.73 KB
/
deploy_lambda.yml
File metadata and controls
65 lines (57 loc) · 1.73 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy-Lambda-Python
on:
# push:
# branches:
# - "main"
# pull_request:
# paths:
# - "**/*.py"
# - "**/deploy_lambda.yml"
workflow_dispatch:
permissions:
id-token: write
contents: read
env:
PYTHON_VERSION: 3.13
lambda-role-arn: ${{ secrets.LAMBDA_ROLE_ARN }}
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
lambda-function:
- name: external_library_lambda
directory: external_library_lambda
- name: hello_lambda
directory: hello_lambda
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install dependencies to deployment package
working-directory: ${{ matrix.lambda-function.directory }}
run: |
pip install -r requirements.txt -t .
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
- name: Deploy Lambda
uses: aws-actions/aws-lambda-deploy@v1.0.1
with:
function-name: ${{ matrix.lambda-function.name }}
code-artifacts-dir: ./${{ matrix.lambda-function.directory }}
handler: app.lambda_handler
runtime: python${{ env.PYTHON_VERSION }}
role: ${{ env.lambda-role-arn }}
timeout: 30
environment: |
{
"YOUR_ENV_VAR_1": "<environment-val1>",
"YOUR_ENV_VAR_2": "<environment-val2>"
}