-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (98 loc) · 3.16 KB
/
deploy.yml
File metadata and controls
98 lines (98 loc) · 3.16 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: deploy
on:
push:
branches:
- main
paths:
- "handler.py"
- "Pipfile*"
pull_request:
branches:
- main
paths:
- "handler.py"
- "Pipfile*"
- "requirements.txt"
- ".github/workflows/deploy.yml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.14"
architecture: "x64"
cache: "pipenv"
cache-dependency-path: Pipfile.lock
- name: Install pipenv
run: |
pip install --prefer-binary -r requirements.txt
pipenv install --dev
- name: Check linting & formatting
run: |
pipenv run flake8 .
pipenv run black --check .
package:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.14"
architecture: "x64"
cache: "pipenv"
cache-dependency-path: Pipfile.lock
- name: Install pipenv
run: |
pip install --prefer-binary -r requirements.txt
pipenv install
- name: Create deployment package
run: |
pipenv requirements > requirements.txt
pip install --prefer-binary -r requirements.txt --target ${{ github.workspace }}/package
cp handler.py ${{ github.workspace }}/package
- name: Upload package
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: lambda-package
path: ${{ github.workspace}}/package
overwrite: true
retention-days: 1
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
environment: AWS
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [package, check]
permissions:
id-token: write
contents: read
steps:
- name: Download package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ${{ github.workspace }}/package
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
- name: Deploy
uses: aws-actions/aws-lambda-deploy@29ea35c124579506cf0475e20df36198eb670d89 # v1.1.0
with:
function-name: ${{ vars.LAMBDA_NAME }}
package-type: Zip
runtime: python3.14
handler: handler.handler
publish: false
code-artifacts-dir: ${{ github.workspace }}/package