Skip to content

Publish to PyPI via Trusted Publishing (OIDC) - #67

Merged
jedymatt merged 1 commit into
mainfrom
switch-to-trusted-publishing
Jul 4, 2026
Merged

Publish to PyPI via Trusted Publishing (OIDC)#67
jedymatt merged 1 commit into
mainfrom
switch-to-trusted-publishing

Conversation

@jedymatt

@jedymatt jedymatt commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Replaces the long-lived PYPI_API_TOKEN secret with PyPI Trusted Publishing (OIDC). Follow-up to the v2.1.0 revival — removes the 5-year-old account-scoped token as a credential to leak, rotate, or expire.

What changed

  • python-publish.yml now runs uv publish with permissions: id-token: write; uv auto-detects the GitHub Actions OIDC credentials.
  • Dropped the pypa/gh-action-pypi-publish step and the secrets.PYPI_API_TOKEN reference.

Required before the next release (maintainer, one-time on PyPI)

  1. Add the Trusted Publisher: https://pypi.org/manage/project/sqlalchemyseed/settings/publishing/
    • Owner: jedymatt · Repository: sqlalchemyseed · Workflow: python-publish.yml · Environment: (blank)
  2. Revoke the old 2021 account-scoped API token: https://pypi.org/manage/account/token/
  3. Delete the now-unused PYPI_API_TOKEN GitHub secret (can be done via gh secret delete).

Until step 1 is done, a release run would fail at the publish step — no data risk, just a failed upload.

🤖 Generated with Claude Code

Replace the long-lived PYPI_API_TOKEN secret with PyPI Trusted Publishing.
The release job now mints a short-lived OIDC token (id-token: write) that
PyPI exchanges for an upload token, so there is no stored credential to
leak, rotate, or expire.

Requires a one-time Trusted Publisher config on PyPI (owner jedymatt,
repo sqlalchemyseed, workflow python-publish.yml). The old account-scoped
token should be revoked on PyPI and its GitHub secret removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jedymatt
jedymatt merged commit 04671d9 into main Jul 4, 2026
19 checks passed
@jedymatt
jedymatt deleted the switch-to-trusted-publishing branch July 4, 2026 12:42
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.

1 participant