Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 24 additions & 51 deletions .github/workflows/build-python-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Derive short Python version
shell: bash
Expand All @@ -58,18 +58,23 @@ jobs:

# mobile-forge artifact: iOS-only install+support tree (same structure as before).
# Captured before the macOS build also writes into ./support / ./install.
tar -czf dist/python-ios-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support
tar -czf dist/python-ios-mobile-forge-$PYTHON_VERSION.tar.gz install support

# macOS: universal2 framework built from source (all versions).
python build_macos.py "$PYTHON_VERSION"

bash ./package-ios-for-dart.sh . "$PYTHON_VERSION_SHORT"
bash ./package-macos-for-dart.sh . "$PYTHON_VERSION_SHORT"
# Package scripts receive the FULL Python version: the tarball name
# carries it verbatim so a date-keyed release can host multiple
# patches of the same minor (e.g. 3.14.5 + 3.14.6) side by side.
# Internal lookups inside the scripts derive the short version
# themselves where they need it.
bash ./package-ios-for-dart.sh . "$PYTHON_VERSION"
bash ./package-macos-for-dart.sh . "$PYTHON_VERSION"

- name: Upload Darwin build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: python-darwin-${{ env.PYTHON_VERSION_SHORT }}
name: python-darwin-${{ env.PYTHON_VERSION }}
path: darwin/dist/python-*.tar.gz
if-no-files-found: error

Expand All @@ -78,7 +83,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Derive short Python version
shell: bash
Expand All @@ -102,7 +107,7 @@ jobs:
run: |
bash ./build-all.sh "$PYTHON_VERSION"
mkdir -p dist
tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support
tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION.tar.gz install support
bash ./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a
bash ./package-for-dart.sh install "$PYTHON_VERSION" x86_64
read version_major version_minor < <(echo "$PYTHON_VERSION" | sed -E 's/^([0-9]+)\.([0-9]+).*/\1 \2/')
Expand All @@ -120,9 +125,9 @@ jobs:
run: python3 -m unittest discover -s android/tests -t android/tests -v

- name: Upload build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: python-android-${{ env.PYTHON_VERSION_SHORT }}
name: python-android-${{ env.PYTHON_VERSION }}
path: android/dist/python-android-*.tar.gz
if-no-files-found: error

Expand All @@ -131,7 +136,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Derive short Python version
shell: bash
Expand All @@ -153,17 +158,17 @@ jobs:
bash ./package-for-linux.sh aarch64 ""

- name: Upload build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: python-linux-${{ env.PYTHON_VERSION_SHORT }}
name: python-linux-${{ env.PYTHON_VERSION }}
path: linux/python-linux-dart-*.tar.gz
if-no-files-found: error

build-windows:
name: Build Python for Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Derive short Python version
shell: pwsh
Expand All @@ -184,44 +189,12 @@ jobs:
-PythonVersionShort "${{ env.PYTHON_VERSION_SHORT }}"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: python-windows-${{ env.PYTHON_VERSION_SHORT }}
name: python-windows-${{ env.PYTHON_VERSION }}
path: windows/python-windows-for-dart-*.zip
if-no-files-found: error

publish-release:
name: Publish Release Assets
runs-on: ubuntu-latest
# Only publish GitHub release assets from the main branch; other branches still
# build (and upload per-job artifacts) but don't touch releases.
if: github.ref == 'refs/heads/main'
needs:
- build-darwin
- build-android
- build-linux
- build-windows
permissions:
contents: write
steps:
- name: Derive short Python version
shell: bash
run: |
echo "PYTHON_VERSION_SHORT=$(echo "$PYTHON_VERSION" | cut -d. -f1,2)" >> "$GITHUB_ENV"

- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
pattern: python-*-${{ env.PYTHON_VERSION_SHORT }}
path: release-artifacts
merge-multiple: true

- name: Publish all artifacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.PYTHON_VERSION_SHORT }}
files: release-artifacts/*
fail_on_unmatched_files: true
generate_release_notes: false
draft: false
prerelease: false
# The publish-release job lives in the parent workflow (build-python.yml):
# date-keyed releases collect tarballs from every matrix entry into one
# release, so the publish step has to run after the full matrix completes.
41 changes: 41 additions & 0 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ on:
push:
pull_request:
workflow_dispatch:
inputs:
release_date:
description: >
Release tag (YYYYMMDD). When set, a single GitHub release with that
tag is created and all per-platform tarballs from every matrix entry
are published as assets. Leave empty for a build-only run that uploads
per-job artifacts but does not publish a release.
required: false
type: string
default: ""

# Cancel in-flight runs when a newer event arrives for the same logical branch.
concurrency:
Expand All @@ -24,3 +34,34 @@ jobs:
with:
python_version: ${{ matrix.python_version }}
secrets: inherit

publish-release:
name: Publish Release Assets
runs-on: ubuntu-latest
# Date-keyed releases (PBS-style): only publish when an operator explicitly
# triggers via workflow_dispatch with a `release_date` input. Pushes still
# exercise the matrix but leave per-job artifacts for inspection and do
# not touch GitHub releases.
if: github.event_name == 'workflow_dispatch' && inputs.release_date != ''
needs:
- build-matrix
permissions:
contents: write
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v8
with:
pattern: python-*
path: release-artifacts
merge-multiple: true

- name: Publish all artifacts to release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ inputs.release_date }}
name: ${{ inputs.release_date }}
files: release-artifacts/*
fail_on_unmatched_files: true
generate_release_notes: false
draft: false
prerelease: false
6 changes: 4 additions & 2 deletions android/package-for-dart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ done

rm -rf $build_dir/lib

# final archive
tar -czf dist/python-android-dart-$python_version_short-$abi.tar.gz -C $build_dir .
# final archive — filename uses the FULL python version (e.g. 3.14.6, not
# 3.14) so a single date-keyed release can host multiple patches of the
# same minor side by side.
tar -czf dist/python-android-dart-$python_version-$abi.tar.gz -C $build_dir .
6 changes: 4 additions & 2 deletions darwin/package-ios-for-dart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@ rm -rf __pycache__
rm -rf **/__pycache__
cd -

# final archive
tar -czf dist/python-ios-dart-$python_version_short.tar.gz -C $build_dir .
# final archive — filename uses the FULL python version (e.g. 3.14.6, not
# 3.14) so a single date-keyed release can host multiple patches of the
# same minor side by side.
tar -czf dist/python-ios-dart-$python_version.tar.gz -C $build_dir .
6 changes: 4 additions & 2 deletions linux/package-for-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ fi
mkdir -p $PYTHON_ARCH/dist
rsync -av --exclude-from=python-linux-dart.exclude $PYTHON_ARCH/build/python/* $PYTHON_ARCH/dist

# archive
tar -czf "python-linux-dart-$PYTHON_VERSION_SHORT-$PYTHON_ARCH.tar.gz" -C "$PYTHON_ARCH/dist" .
# archive — filename uses the FULL python version (e.g. 3.14.6, not 3.14)
# so a single date-keyed release can host multiple patches of the same
# minor side by side.
tar -czf "python-linux-dart-$PYTHON_VERSION-$PYTHON_ARCH.tar.gz" -C "$PYTHON_ARCH/dist" .
6 changes: 4 additions & 2 deletions windows/package-for-dart.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ $srcDir = Join-Path $srcRoot "Python-$PythonVersion"
$pcbuildDir = Join-Path $srcDir "PCbuild\amd64"
$pythonTag = $PythonVersionShort -replace '\.', ''

$packageRoot = Join-Path $workspace "windows\python-windows-for-dart-$PythonVersionShort"
$zipPath = Join-Path $workspace "windows\python-windows-for-dart-$PythonVersionShort.zip"
# Filename uses the FULL python version (e.g. 3.14.6, not 3.14) so a single
# date-keyed release can host multiple patches of the same minor side by side.
$packageRoot = Join-Path $workspace "windows\python-windows-for-dart-$PythonVersion"
$zipPath = Join-Path $workspace "windows\python-windows-for-dart-$PythonVersion.zip"
$excludeListPath = Join-Path $workspace "windows\python-windows-dart.exclude"
$keepImportLibs = @("python3.lib", "python3_d.lib", "python$pythonTag.lib", "python${pythonTag}_d.lib")

Expand Down
Loading