Skip to content

ci: migrate PyPI publishing to OIDC Trusted Publishing#363

Merged
jesseturner21 merged 1 commit intomainfrom
ci/trusted-publishing-oidc
Mar 24, 2026
Merged

ci: migrate PyPI publishing to OIDC Trusted Publishing#363
jesseturner21 merged 1 commit intomainfrom
ci/trusted-publishing-oidc

Conversation

@sundargthb
Copy link
Contributor

Migrate PyPI Publishing to Trusted Publishing

Update our PyPI release workflow by migrating from a long-lived API token to OpenID Connect (OIDC) Trusted Publishing — the current recommended approach by PyPI for publishing from GitHub Actions.

What changed

Long-lived API tokens are a maintenance burden. With this change, GitHub will now generate a short-lived cryptographic token at publish time that PyPI verifies directly. The token is scoped to a single workflow run and expires immediately after.

What else was improved

The version existence check before publishing was updated to use the official PyPI JSON API, which is stable and versioned, replacing a previous approach that was fragile across different environments.

After this PR merges

Once the next release confirms publishing works correctly, the old PYPI_API_TOKEN secret should be deleted from the repo settings and the corresponding token removed from PyPI account settings.

No functional change to the release process: The trigger, the approval gate, the build steps, and the GitHub Release creation are all identical to before. Only the authentication mechanism for the PyPI publish step has changed.​​​​​​​​​​​​​​​​

@sundargthb sundargthb requested a review from a team March 24, 2026 18:46
@sundargthb sundargthb force-pushed the ci/trusted-publishing-oidc branch from 6a450c6 to 69a60f7 Compare March 24, 2026 18:48
@tejaskash tejaskash enabled auto-merge (squash) March 24, 2026 20:55
@jesseturner21 jesseturner21 disabled auto-merge March 24, 2026 22:07
@jesseturner21 jesseturner21 enabled auto-merge (squash) March 24, 2026 22:08
@jesseturner21 jesseturner21 disabled auto-merge March 24, 2026 22:25
@jesseturner21 jesseturner21 merged commit 5bdf009 into main Mar 24, 2026
22 of 24 checks passed
@tejaskash tejaskash deleted the ci/trusted-publishing-oidc branch March 24, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants