Repository navigation
ci: publish to PyPI via trusted publishing (OIDC) - #211
Merged
Merged
Conversation
Replace the PYPI_TOKEN-based poetry publish with pypa/gh-action-pypi-publish, which authenticates through GitHub OIDC against the trusted publisher configured on PyPI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pypa/gh-action-pypi-publish treats self-hosted runners (Blacksmith) as best effort. Matches magic-hour-node, whose publish job also runs on ubuntu-latest. 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.
Why
Publishing used a long-lived
PYPI_TOKENsecret. A leaked token could push any version to PyPI until someone revoked it. Trusted publishing replaces it: GitHub issues a short-lived OIDC token per run, and PyPI accepts it only frommagichourhq/magic-hour-pythonrunningpublish.yml. The Node SDK already publishes this way.What changes
id-token: writeso it can request the OIDC token.poetry publish --build --password=$PYPI_TOKENbecomespoetry buildpluspypa/gh-action-pypi-publish(pinned to v1.14.3 by SHA). Uploads also get PEP 740 attestations by default.ubuntu-latestinstead of Blacksmith. The action treats self-hosted runners as best effort, and the Node SDK's publish job runs on GitHub-hosted runners too. Tests and the release workflow stay on Blacksmith.Setup / follow-up
magichourhq/magic-hour-python, workflowpublish.yml, any environment.PYPI_TOKENrepo secret and revoke the token on PyPI.🤖 Generated with Claude Code