Skip to content

CI: add PyPI Trusted-Publishing “publish” job to wheels workflow (#61669) #61718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

evgmosme
Copy link

@evgmosme evgmosme commented Jun 27, 2025

Summary

This PR enables Trusted Publishing (OIDC) uploads to PyPI when a GitHub release is published.

What’s changed

  • .github/workflows/wheels.yml

    • adds a new publish job that
      1. downloads all wheel / sdist artifacts from upstream jobs;
      2. excludes Pyodide wheels (*pyodide*.whl);
      3. runs pypa/gh-action-pypi-publish@v1 in the pypi environment.
  • doc/source/whatsnew/v3.0.0.rst

    • adds a single Build / CI line announcing the switch to Trusted Publishing
  • doc/source/development/maintaining.rst

    • drop manual twine step and note Trusted Publishing

No other files or CI matrix settings were changed.

@evgmosme evgmosme requested a review from mroeschke as a code owner June 27, 2025 08:03
@evgmosme
Copy link
Author

evgmosme commented Jun 27, 2025

CI failed in the docstring-validation step with

AttributeError: 'getset_descriptor' object has no attribute '__module__'. Did you mean: '__reduce__'?

This occurs before my code runs, so it isn’t caused by the changes in this PR.
It looks related to the latest numpydoc release.
I’ll re-run CI once the upstream fix lands.

@evgmosme evgmosme closed this Jun 28, 2025
@evgmosme evgmosme reopened this Jun 28, 2025
@EpicWink
Copy link

This workflow runs every day, on all pushes, and on all pull requests, but you said "uploads to PyPI when a release tag is pushed" in the description. Perhaps you want to put this in a new publish.yml workflow file, with on: { release: { types: [published] } }.

Because this makes the download-artifacts step run in a different workflow, you'll need to figure out the run-id argument.

You could alternatively add on: { release: { types: [published] } } to the wheels.yml workflow.


You need to update the release process documentation to change the new method for publishing (remove step 5: "Upload wheels to PyPI").


You likely want to document (in this pull request's description, and in the release process documentation) the new pypi GitHub environment needs to exist, and the corresponding publisher needs to be added to the project in PyPI.

@simonjayhawkins simonjayhawkins added Enhancement Build Library building on various platforms CI Continuous Integration labels Jun 30, 2025
@evgmosme evgmosme force-pushed the trusted-publish-pypi branch from d6552ce to 58cb179 Compare June 30, 2025 15:09
@evgmosme evgmosme force-pushed the trusted-publish-pypi branch from 6232f6f to 7359e1b Compare June 30, 2025 15:40
@evgmosme
Copy link
Author

@EpicWink All requested changes are in. Let me know if anything else’s needed - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms CI Continuous Integration Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Switch to trusted publishing for package upload to PyPI in CI
4 participants