Skip to content

Commit 1c52f71

Browse files
committed
Package Amazon Lambda layer and deploy to S3.
1 parent 4303dfa commit 1c52f71

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/cd.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: cd
2+
on:
3+
push:
4+
branches: [main] # FIXME
5+
tags: ['*.*']
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
environment: aws
10+
permissions:
11+
contents: read
12+
id-token: write
13+
env:
14+
AWS_BUCKET: ${{ vars.AWS_BUCKET }}
15+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
16+
AWS_ROLE: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/GitHubActions
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.9"
22+
# https://docs.aws.amazon.com/lambda/latest/dg/python-layers.html#python-layer-packaging
23+
- name: Packaging the layer content
24+
run: |
25+
python -m venv create_layer
26+
source create_layer/bin/activate
27+
pip install -r requirements.txt
28+
mkdir python
29+
cp -r create_layer/lib python
30+
zip -r layer_content.zip python
31+
- uses: aws-actions/configure-aws-credentials@v4
32+
with:
33+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
34+
role-to-assume: ${{ env.AWS_ROLE }}
35+
- run: aws s3 cp layer_content.zip s3://${{ env.AWS_BUCKET }}/vtwsclib.zip

0 commit comments

Comments
 (0)