-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Package Amazon Lambda layer and deploy to S3.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: cd | ||
on: | ||
push: | ||
branches: [main] # FIXME | ||
tags: ['*.*'] | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: aws | ||
env: | ||
AWS_BUCKET: ${{ vars.AWS_BUCKET }} | ||
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} | ||
AWS_ROLE: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/GitHubActions | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
# https://docs.aws.amazon.com/lambda/latest/dg/python-layers.html#python-layer-packaging | ||
- name: Packaging the layer content | ||
run: | | ||
python -m venv create_layer | ||
source create_layer/bin/activate | ||
pip install -r requirements.txt | ||
mkdir python | ||
cp -r create_layer/lib python | ||
zip -r layer_content.zip python | ||
- uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-region: ${{ env.AWS_DEFAULT_REGION }} | ||
role-to-assume: ${{ env.AWS_ROLE }} | ||
- run: aws s3 cp layer_content.zip s3://${{ env.AWS_BUCKET }}/vtwsclib.zip |