Skip to content

Commit ed59c61

Browse files
committed
Package Amazon Lambda layer and deploy to S3.
1 parent 20490ee commit ed59c61

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/cd.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
env:
11+
AWS_BUCKET: ${{ vars.AWS_BUCKET }}
12+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
13+
AWS_ROLE: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/GitHubActions
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.9"
19+
# https://docs.aws.amazon.com/lambda/latest/dg/python-layers.html#python-layer-packaging
20+
- name: Packaging the layer content
21+
run: |
22+
python -m venv create_layer
23+
source create_layer/bin/activate
24+
pip install -r requirements.txt
25+
mkdir python
26+
cp -r create_layer/lib python
27+
zip -r layer_content.zip python
28+
- uses: aws-actions/configure-aws-credentials@v2
29+
with:
30+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
31+
role-to-assume: ${{ env.AWS_ROLE }}
32+
- run: aws s3 cp layer_content.zip s3://${{ env.AWS_BUCKET }}/vtwsclib.zip

0 commit comments

Comments
 (0)