Build and upload Python 3.10.12 #22
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
name: Build and upload Python runtime | |
run-name: "Build and upload Python ${{ inputs.python_version }}${{ inputs.dry_run && ' (dry run)' || '' }}" | |
on: | |
workflow_dispatch: | |
inputs: | |
python_version: | |
description: "The Python version to build, specified as X.Y.Z" | |
type: string | |
required: true | |
dry_run: | |
description: "Skip deploying to S3 (e.g. for testing)" | |
type: boolean | |
default: false | |
required: false | |
permissions: | |
contents: read | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-west-2" | |
S3_BUCKET: "heroku-buildpack-python" | |
# Unfortunately these jobs cannot be easily written as a matrix since `matrix.exclude` does not | |
# support expression syntax, and the `inputs` context is not available inside the job `if` key. | |
jobs: | |
build-and-upload-heroku-20: | |
runs-on: pub-hk-ubuntu-22.04-xlarge | |
env: | |
STACK_VERSION: "20" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build Docker image | |
run: docker build --pull --tag buildenv --build-arg=STACK_VERSION builds/ | |
- name: Build and package Python runtime | |
run: docker run --rm --platform="linux/amd64" --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}" | |
- name: Upload Python runtime archive to S3 | |
if: (!inputs.dry_run) | |
run: aws s3 sync ./upload "s3://${S3_BUCKET}" | |
build-and-upload-heroku-22: | |
# We only support Python 3.9+ on Heroku-22. | |
if: (!startsWith(inputs.python_version, '3.7.') && !startsWith(inputs.python_version,'3.8.')) | |
runs-on: pub-hk-ubuntu-22.04-xlarge | |
env: | |
STACK_VERSION: "22" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build Docker image | |
run: docker build --pull --tag buildenv --build-arg=STACK_VERSION builds/ | |
- name: Build and package Python runtime | |
run: docker run --rm --platform="linux/amd64" --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}" | |
- name: Upload Python runtime archive to S3 | |
if: (!inputs.dry_run) | |
run: aws s3 sync ./upload "s3://${S3_BUCKET}" |