Repository navigation
Publish releases to PyPI from GitHub Actions - #663
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
Publishworkflow that builds the package from a published GitHub release and uploads it to PyPI with Trusted Publishing. PyPI then shows provenance for each file: signed attestations (PEP 740) of the repository, commit and workflow that built it. The current releases were uploaded by hand with an API token, so PyPI shows "None of the files in this release were uploaded with provenance metadata."buildjob checks that the release tag isvfollowed by the version inpyproject.toml, builds the wheel and source distribution withuv build, and passes them to thepublishjob. That job runs in thepypienvironment with onlyid-token: write, and uploads them withpypa/gh-action-pypi-publish, which creates and uploads the attestations.With this, a release is made by creating the GitHub release (tag and notes), and CI uploads it. No PyPI token is needed.
Before the next release
MIT-LCP, repositorywfdb-python, workflowpublish.yml, environmentpypi.pypi, ideally requiring a maintainer's approval before each upload.Testing
actionlintreports no problems.v5.1.0and rejects a different version or a tag without thev.uv buildproduces a wheel and source distribution that passtwine check. The build job also runs on this pull request.@tompollard 🟥 red 🦥 sloth · aspen