PyPI CI/CD credentials: long-lived API token or Trusted Publishing
Choose between a long-lived PyPI API token and Trusted Publishing (OIDC) for CI/CD package uploads, with trade-offs, a GitHub Actions example, and validation steps.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Choose between a long-lived PyPI API token and Trusted Publishing (OIDC) for CI/CD package uploads, with trade-offs, a GitHub Actions example, and validation steps.
Long-lived PyPI API tokens in CI are a standing risk. Trusted Publishing uses OpenID Connect to issue short-lived, workflow-scoped credentials automatically—here is how to wire it up and what to watch for.
When automating Python package uploads to PyPI, you must decide between the new Trusted Publishing flow that uses OIDC tokens and the classic scoped API tokens. This guide compares security, setup, and practical steps for GitHub Actions, GitLab, and other CI providers.
Learn how PyPI’s Trusted Publishing uses OIDC to replace static tokens in CI/CD pipelines, with a step‑by‑step GitHub Actions example, trade‑offs, and a quick verification checklist.
Learn how PyPI’s Trusted Publishing feature lets you automate package uploads from CI pipelines using short‑lived OIDC tokens, eliminating the need for long‑term API keys. The blog walks through a GitHub Actions setup, explains the token flow, and highlights trade‑offs.
Learn how to create scoped API tokens for PyPI, use them with twine, verify uploads, and revoke tokens to reduce secret sprawl.
Long-lived PyPI tokens in CI are a standing risk. Trusted publishing uses OIDC claims to grant short-lived upload rights without storing secrets.