Repository navigation
Publish to PyPI with trusted publishing - #610
Merged
Merged
Conversation
Replace the organisation-wide PYPI token with PyPI trusted publishing (OIDC) in the publish job, which now runs in the pypi environment limited to master. Adds a changelog fragment so merging cuts a patch release that verifies the new path end to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What and why
The organisation-wide
PYPIsecret (created 2021) is readable by every PolicyEngine repository's workflows. This movespolicyengine-coreto PyPI trusted publishing: PyPI accepts uploads only from this repository'spush.yamlworkflow running in thepypienvironment, using a short-lived OIDC token, so no PyPI credential is stored here.Publishjob in.github/workflows/push.yamlnow runs inenvironment: pypiand addsid-token: writenext to its existingcontents: write(still needed for the git tag step).user: __token__andpassword: ${{ secrets.PYPI }}are removed frompypa/gh-action-pypi-publish. While a password is passed, the action uses it rather than trusted publishing.changelog.d/trusted-publishing.changed.mdmakes merging cut a patch release, which tests the new publishing path end to end.The
pypienvironment already exists in this repository and is limited to themasterbranch.Before merging (draft until this is done)
A PyPI owner of
policyengine-coreadds the publisher under Manage → Publishing → GitHub:PolicyEnginepolicyengine-corepush.yamlpypiIf this merges first, the release fails with
invalid-publisheruntil the publisher is added; then re-run the job.Test plan
actionlinton the changed workflow (no new findings)Publishjob succeeds and the new files on PyPI show provenance fromPolicyEngine/policyengine-core/push.yaml🤖 Generated with Claude Code