ci(release): migrate to PyPI trusted publishing#2089
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2089 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 55 55
Lines 5949 5949
=======================================
Hits 5822 5822
Misses 127 127
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
178fc2e to
5a4b7db
Compare
sisp
commented
Apr 23, 2025
| push: | ||
| branches: [master] | ||
| tags: ["*"] | ||
| workflow_dispatch: |
Member
Author
There was a problem hiding this comment.
Disabling this workflow for pushed tags should resolve the following problem with Codecov:
Coverage data is based on head 8e9a87f (15 uploads) compared to base f215a23 (30 uploads)
30 instead of 15 uploads are cause by the two CI runs triggered by the pushed release commit to master and the tag that references that same commit.
5a4b7db to
cf6bcd4
Compare
sisp
commented
Apr 25, 2025
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.
I've migrated our release workflow from using PyPI access tokens to trusted publishing.
A few remarks about advice on https://docs.pypi.org/trusted-publishers/security-model/ that I've followed:
release.ymlthat is trusted by pypi.org. But it seems that dependence on jobs from another workflow (here,buildandflake-checkfromci.yml) vianeedsisn't supported. The only alternative I've found is dependence on the completion and success of a complete workflow viaworkflow_runandjob.<job_id>.if: ${{ github.event.workflow_run.conclusion == 'success' }}, but I haven't found a Python project that implements this approach. I think it's sufficiently safe to assume that the tests are passing when making a release, but I'm open to hearing different opinions.buildandpublish/publish-testjobs where only the latter have write permissions.pypi/pypi-testscoped to tags with the name patternv*.As before, the distribution files are uploaded to test.pypi.org when a tag is pushed. In a follow-up PR, I plan to change this setup to upload to test.pypi.org also on the default branch (
master) to test the publishing process more regularly (with some inspiration fromgithub.com/iterative-ai/dvc:.github/workflows/build.yaml).Todos after merging this PR: