Skip to content

Update python version #18

Update python version

Update python version #18

name: "Python General Layers"
on:
push:
branches:
- main
paths:
- 'python-requirements-general.txt'
- '.github/workflows/python-general.yml'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
deploy:
runs-on: ubuntu-20.04
strategy:
matrix:
region: [
us-east-2,
us-east-1,
us-west-1,
us-west-2,
af-south-1,
ap-east-1,
ap-southeast-3,
ap-south-1,
ap-northeast-3,
ap-northeast-2,
ap-southeast-1,
ap-southeast-2,
ap-northeast-1,
ca-central-1,
eu-central-1,
eu-west-1,
eu-west-2,
eu-south-1,
eu-west-3,
eu-north-1,
me-south-1,
sa-east-1]
steps:
- uses: actions/checkout@v2
- name: Set up Python 🐍
uses: actions/setup-python@v1
with:
python-version: 3.10
- name: Install workflow dependencies 📦
run: |
sudo apt-get update
sudo apt-get install -y build-essential libpoppler-cpp-dev pkg-config python-dev
# pip install --target=python boto3
- name: Install layer dependencies 📦
run: |
mkdir -p python
pip install --target=python -r python-requirements-general.txt
zip -r dependencies.zip ./python
- name: Publish layer 🚀
env:
region: ${{ matrix.region }}
run: |
result=$(aws lambda publish-layer-version \
--region $region \
--layer-name "common-python-libraries" \
--description "Common python libraries" \
--zip-file fileb://dependencies.zip \
--compatible-runtimes python3.6 python3.7 python3.8 python3.9 python3.10)
LAYER_VERSION=$(jq '.Version' <<< "$result")
LAYER_VERSION_ARN=$(jq '.LayerVersionArn' <<< "$result")
LAYER_ARN=$(jq '.LayerArn' <<< "$result")
echo "Latest version in $region is $LAYER_VERSION"
result=$(aws lambda add-layer-version-permission \
--region $region \
--layer-name "common-python-libraries" \
--statement-id public \
--action lambda:GetLayerVersion \
--principal "*" \
--version-number $LAYER_VERSION)