Skip to content

ci: only run Python Release Build on RC tags and matching PRs#1754

Merged
andygrove merged 2 commits into
apache:mainfrom
andygrove:ci/restrict-release-build-triggers
May 23, 2026
Merged

ci: only run Python Release Build on RC tags and matching PRs#1754
andygrove merged 2 commits into
apache:mainfrom
andygrove:ci/restrict-release-build-triggers

Conversation

@andygrove
Copy link
Copy Markdown
Member

@andygrove andygrove commented May 23, 2026

Which issue does this PR close?

Closes #.

Rationale for this change

Two small fixes to the Python Release Build workflow.

1. Triggers. The current on: block has two problems. It runs the wheel pipeline on every push to a release branch (push: branches: ["branch-*"]) — heavy, and a release-branch push isn't the canonical event for cutting artifacts; the RC tag is. It also gates tag pushes on a paths: ["python/**"] filter scoped to the whole push: block, so an RC tag push only triggers if the tagged commit changed python/**. 53.0.0-rc1 happened to trigger only because GitHub's paths filter on tag pushes compares against the previous tag (which had python/** changes since the prior release). Relying on that is fragile.

2. Sdist assertion was always vacuous. build-sdist's assertion step ran ls -A target/wheels from the default workdir. Because each run: step starts with cwd reset to the workspace root, the cd python from the previous step did not carry over and target/wheels resolved to <repo>/target/wheels, which doesn't exist. ls -A returned empty and the assertion always printed "Directory is clean" regardless of what maturin actually produced.

What changes are included in this PR?

.github/workflows/build.yml:

  • Drop branches: and paths: from the push: block, leaving only tags: ["*-rc*"]. The pull-request trigger is unchanged.
  • Rewrite the sdist assertion to cd python and find dist target/wheels -name '*.whl', covering both the current --out dist location and the older default target/wheels/.

Resulting trigger semantics:

Event Fires?
PR touching python/** ✅ (build + test-release only; wheel jobs skip on PR per #1749)
PR not touching python/**
Push of any *-rc* tag ✅ always, regardless of paths
Push to branch-*
Push to main

Are there any user-facing changes?

No code changes. CI-only. Release managers should be aware: cutting an RC is now the sole trigger for producing release artifacts on the apache repo, and it always rebuilds regardless of what the RC commit touched.

The previous `on:` block ran the wheel pipeline on every push to a
release branch (`branches: ["branch-*"]`) and used a single `paths:`
filter that, by being scoped to the whole `push:` block, also gated tag
pushes on a python/** path change. Neither is desirable:

- Pushes to `branch-*` (commits, cherry-picks, changelog updates) don't
  need to rebuild release wheels. The RC tag push is the canonical
  event that produces release artifacts.
- RC tag pushes should always rebuild, regardless of which paths the RC
  commit happens to touch. Today's `53.0.0-rc1` push only modified
  `CHANGELOG.md` and triggered the workflow only because of how
  GitHub's `paths` filter handles tag pushes (comparing against the
  previous tag, which happened to include python/** changes). Relying
  on that is fragile.

Drop both `branches:` and `paths:` from the `push:` block, leaving just
`tags: ["*-rc*"]`. The `pull_request: paths:` filter is unchanged.

The set of events that fire the workflow is now:
- pull_request that changes any python/** file
- push of any tag matching `*-rc*`
The previous assertion ran `ls -A target/wheels` from the default
workdir (the repo root). Because each \`run:\` step starts with cwd reset
to the workspace root, the \`cd python\` from the previous step did not
carry over and \`target/wheels\` resolved to \`<repo>/target/wheels\`,
which doesn't exist. \`ls -A\` returned empty and the assertion always
printed \"Directory is clean\" regardless of what maturin actually
produced.

Switch to checking both \`python/dist/\` (where \`--out dist\` lands
maturin output today) and \`python/target/wheels/\` (the older default,
in case maturin behavior or flags change) for \`*.whl\` files via
\`find\`, so the assertion now actually fails when sdist accidentally
produces wheels.
@andygrove andygrove marked this pull request as ready for review May 23, 2026 21:13
@andygrove andygrove merged commit df1558a into apache:main May 23, 2026
19 checks passed
@andygrove andygrove deleted the ci/restrict-release-build-triggers branch May 23, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant