Skip to content

ci: publish to PyPI on GitHub Release via Trusted Publishing - #202

Open
aqeelat wants to merge 7 commits into
pytest-dev:mainfrom
aqeelat:auto_release
Open

ci: publish to PyPI on GitHub Release via Trusted Publishing#202
aqeelat wants to merge 7 commits into
pytest-dev:mainfrom
aqeelat:auto_release

Conversation

@aqeelat

@aqeelat aqeelat commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Replaces #154, which cannot be reopened or retargeted because its base branch master was deleted.

Publishes to PyPI when a GitHub Release is published, following the pytest-mock deploy pattern:

  • package job: builds sdist+wheel with hynek/build-and-inspect-python-package (twine check + wheel-contents check included), attests GitHub build provenance. Only id-token: write + attestations: write.
  • publish job: downloads the artifact and publishes via pypa/gh-action-pypi-publish with PyPI attestations, through the release environment with Trusted Publishing (no token). Only id-token: write.
  • Both jobs guarded by github.repository_owner == 'pytest-dev'.
  • Adds RELEASING.rst documenting the process.

Addresses all review feedback from #154 (split build/publish jobs, release environment, RELEASING.rst, owner check, release: published trigger, drop EOL Python pin).

Setup needed once by a maintainer: register the PyPI Trusted Publisher for pytest-timeout (owner pytest-dev, repo pytest-timeout, workflow release.yaml, environment release).

Abdullah Alaqeel and others added 7 commits August 17, 2026 01:34
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
pytest-dev is not going to fork this and means it's more re-usable

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Otherwise we have to keep changing this.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
- Split build and publish jobs: build with least privilege via
  build-and-inspect-python-package (includes twine check and GitHub
  build provenance attestation), publish with only id-token for
  PyPI Trusted Publishing
- Publish via the release environment with PyPI attestations
- Add RELEASING.rst documenting the release process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants