Add environment: pypi to publish job to match trusted publisher#4
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
Adds
environment: pypito thepublishjob in.github/workflows/release.ymlso the OIDC token claim matches the PyPI trusted-publisher entry (which is registered with environment namepypi).Why
The first
v1.0.1publish failed with:PyPI's pending publisher requires the
environmentclaim to match what's registered. The workflow had noenvironment:declaration on the publish job, so the claim came through asMISSING. Addingenvironment: pypimakes the claim present and matching.What changed
Single 1-line addition in the publish job:
(The PR history contains a misguided rename-then-revert; squash-merging produces just the 1-line net change.)
Required follow-up after merging
The existing
v1.0.1tag points at a commit that doesn't haveenvironment: pypi, so re-running its workflow will still fail. Two user-side steps:The publish workflow will then run with
environment: pypiclaim, OIDC matches the publisher, PyPI accepts.GitHub Environment requirement
Note: trusted publishing with an environment also requires that a GitHub Environment named
pypiexists on the repository (Settings → Environments). If it doesn't exist yet, GitHub will fail the job with "Value 'pypi' is not valid" when looking up the environment. Worth checking before re-tagging.Test plan
pypiexists at https://github.com/mstorath/CSSD/settings/environmentspip install cssd==1.0.1works