-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
base: main
Are you sure you want to change the base?
Conversation
CI failed in the docstring-validation step with
This occurs before my code runs, so it isn’t caused by the changes in this PR. |
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 Because this makes the You could alternatively add 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 |
d6552ce
to
58cb179
Compare
6232f6f
to
7359e1b
Compare
@EpicWink All requested changes are in. Let me know if anything else’s needed - thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Still want to do this, at least in this pull request's description
Co-authored-by: Laurie O <laurie_opperman@hotmail.com>
Co-authored-by: Laurie O <laurie_opperman@hotmail.com>
Co-authored-by: Laurie O <laurie_opperman@hotmail.com>
Co-authored-by: Laurie O <laurie_opperman@hotmail.com>
All comments addressed and conversations resolved - ready for another look. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EvMossan thanks a lot for working on this! (and @EpicWink for the review)
@mroeschke I updated the PyPI configuration to enable trusted publishing on that side.
I suppose we can only test this really once doing a next pre-release?
Could we already test the first part of the added job by temporarily commenting out the last pypa/gh-action-pypi-publish
step, but so at least we can check the downloading and filtering of the artifacts is working?
release: | ||
types: [published] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EpicWink you suggested to add this, but I am wondering if that is needed? As I understand, this wheels.yml workflow will run on the commit pushed to main with a tag, and so that way it will already run for a release? And we can then upload the wheels from that run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A GitHub release publish happens after a push, allowing you to review the CI, and write release notes in the GitHub release, before triggering the publish to PyPI. Up to you how you want the release workflow to be, if you want to publish unconditionally.
An alternative is to split the workflow into two files (and therefore two workflows), where the publish job downloads the artefacts from the build job of the other workflow.
|
||
twine upload pandas/dist/pandas-<version>*.{whl,tar.gz} --skip-existing | ||
5. Verify wheels are uploaded automatically by GitHub Actions | ||
via [**Trusted Publishing**](https://docs.pypi.org/trusted-publishers/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
via [**Trusted Publishing**](https://docs.pypi.org/trusted-publishers/) | |
via `**Trusted Publishing** <https://docs.pypi.org/trusted-publishers/>`__) |
(this file is still in rst, not markdown)
- name: Publish to **PyPI** (Trusted Publishing) | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://upload.pypi.org/legacy/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line needed? (it's not included in the example in https://docs.pypi.org/trusted-publishers/using-a-publisher/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary, and as far as I know there's no recommendation to hard-code it. When the upload API 2.0 PEP lands, in site this URL and action will change anyway.
Yes, fortunately PyPI sports uploading pre-releases.
That could work, as long as it's in a protected tag, but you would be creating a tag just to test this, unless you change the workflow definition further to support a non-version-tag ref. |
pre-commit
& CI)doc/source/whatsnew/v3.0.0.rst
Summary
This PR enables Trusted Publishing (OIDC) uploads to PyPI when a GitHub release is published.
What’s changed
.github/workflows/wheels.yml
publish
job that*pyodide*.whl
);pypa/gh-action-pypi-publish@v1
in thepypi
environment.doc/source/whatsnew/v3.0.0.rst
doc/source/development/maintaining.rst
No other files or CI matrix settings were changed.
Release prerequisites
pypi
(OIDC token permission enabled).pandas-dev/pandas
→ “pypi” as a Trusted Publisher (see https://docs.pypi.org/trusted-publishers/).