Skip to content

Bump the python group across 1 directory with 8 updates #613

Bump the python group across 1 directory with 8 updates

Bump the python group across 1 directory with 8 updates #613

Workflow file for this run

# Creates a new version by:
# 1. bumping the version number in the changelog and cargo
# 2. Creates a new branch for this version
# 3. makes a new commit
# 4. Builds that commit for different platforms
# 5. Once all those build, publishes to PyPI
# 6. Creates a tag and fast-forwards main to the release commit
# This seperates the release process from the test process, so we can still release if we need to and tests are failing
name: Bump Version
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
type:
description: "Release type"
required: true
default: "major"
type: choice
options:
- major
- minor
- patch
jobs:
bump:
runs-on: ubuntu-latest
permissions: write-all
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
outputs:
version: ${{ steps.bump.outputs.version }}
base: ${{ steps.bump.outputs.base }}
commit: ${{ steps.bump.outputs.commit }}
steps:
- name: Check release push token
run: |
if [ -z "$RELEASE_GITHUB_TOKEN" ]; then
echo "::error::Set RELEASE_GITHUB_TOKEN to a token whose actor can bypass main's pull-request and required-check rules."
exit 1
fi
env:
RELEASE_GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@ebb3d1676050bfd0971c36c1e215b5751473994d # 1.96.0
- run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
echo "base=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
VERSION=$(python modify_changelog.py bump_version "$TYPE")
# Update the workspace version without changing dependency pins.
cargo update --workspace
git checkout -b "version-$VERSION"
git commit -am "Version $VERSION [skip ci]"
git push -u origin HEAD
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
id: bump
env:
TYPE: ${{ inputs.type }}
linux-cross:
name: build linux
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64, ppc64]
needs: [bump]
if: ${{ !cancelled() && (needs.bump.result == 'success' || needs.bump.result == 'skipped') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'success' }}
with:
ref: ${{ needs.bump.outputs.commit }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'skipped' }}
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
target: ${{ matrix.target }}
manylinux: auto
command: build
args: --release --locked --sdist -o dist -i python3.12 python3.13 python3.14 python3.14t
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-linux-${{ matrix.target }}
path: dist
linux:
name: build linux
runs-on: ubuntu-latest
needs: [bump]
if: ${{ !cancelled() && (needs.bump.result == 'success' || needs.bump.result == 'skipped') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'success' }}
with:
ref: ${{ needs.bump.outputs.commit }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'skipped' }}
- name: Setup QEMU
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
manylinux: auto
command: build
args: --release --locked --sdist -o dist -i python3.12 python3.13 python3.14 python3.14t
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-linux
path: dist
windows:
name: build windows ${{ matrix.python }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python: ["3.12", "3.13", "3.14", "3.14t"]
needs: [bump]
if: ${{ !cancelled() && (needs.bump.result == 'success' || needs.bump.result == 'skipped') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'success' }}
with:
ref: ${{ needs.bump.outputs.commit }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'skipped' }}
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
args: --release --locked -o dist -i python
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-windows-${{ matrix.python }}
path: dist
macos:
name: build macos
runs-on: macos-latest
needs: [bump]
if: ${{ !cancelled() && (needs.bump.result == 'success' || needs.bump.result == 'skipped') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'success' }}
with:
ref: ${{ needs.bump.outputs.commit }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ needs.bump.result == 'skipped' }}
- name: Set up supported Python interpreters
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
# Keep regular 3.14 last so it takes precedence over the free-threaded alias.
python-version: |
3.12
3.13
3.14t
3.14
- name: Verify Python 3.14 variants
run: |
python3.14 -c 'import sysconfig; assert not sysconfig.get_config_var("Py_GIL_DISABLED")'
python3.14t -c 'import sysconfig; assert sysconfig.get_config_var("Py_GIL_DISABLED") == 1'
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
target: universal2-apple-darwin
args: --release --locked -o dist -i python3.12 python3.13 python3.14 python3.14t
- name: Upload wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-macos
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
needs: [macos, windows, linux, linux-cross, bump]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.bump.outputs.commit }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: wheels-*
merge-multiple: true
path: dist
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
enable-cache: false
- name: Check main before publishing
run: |
MAIN=$(git ls-remote origin refs/heads/main | cut -f1)
if [ "$MAIN" != "$BASE_SHA" ] && [ "$MAIN" != "$RELEASE_SHA" ]; then
echo "::error::main changed since this release was prepared."
exit 1
fi
env:
BASE_SHA: ${{ needs.bump.outputs.base }}
RELEASE_SHA: ${{ needs.bump.outputs.commit }}
- name: Publish to PyPI
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
tag-and-push:
runs-on: ubuntu-latest
permissions: write-all
needs: [release, bump]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.bump.outputs.commit }}
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
fetch-depth: 0
- run: |
# Neither ref changes if main advanced or the tag points to a different commit.
git push --atomic origin "$RELEASE_SHA:refs/heads/main" "$RELEASE_SHA:refs/tags/v$VERSION"
env:
VERSION: ${{ needs.bump.outputs.version }}
RELEASE_SHA: ${{ needs.bump.outputs.commit }}