-
Notifications
You must be signed in to change notification settings - Fork 33
47 lines (39 loc) · 1.7 KB
/
release-lambda.yml
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
# This workflow will build and upload a Python Lambda Layer when a release is created
# The layer is compatible with AWS Lambda Functions using Python 3.9 and x86_64 architecture
# For more information on Lambda Layers, see: https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
# Note: This layer is specifically built for Python 3.9 and x86_64 architecture due to the build process.
# If you need layers for different Python versions or architectures, you'll need to modify the build step.
name: Build and Release Lambda Layer
on:
release:
types: [created]
jobs:
build-and-release-layer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install virtualenv
- name: Create Lambda Layer
run: |
virtualenv venv
source venv/bin/activate
mkdir python
echo "coinbase-advancedtrade-python" > requirements.txt
docker run --rm -v "$PWD":/var/task public.ecr.aws/sam/build-python3.9:latest /bin/sh -c "pip install --platform manylinux2014_x86_64 --implementation cp --python 3.9 --only-binary=:all: --upgrade -r requirements.txt -t python"
zip -r layer-python3.9-x86_64.zip python
- name: Upload Layer to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./layer-python3.9-x86_64.zip
asset_name: layer-python3.9-x86_64.zip
asset_content_type: application/zip