-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use OIDC @ GHA to PyPI publishing guide
This patch rewrites the "Publishing package distribution releases using GitHub Actions CI/CD workflows" guide to use trusted publishing instead of long-lived PyPI API tokens stored as GitHub repository secrets. It also shows how to protect the PyPI publishing job by creating a GitHub Environment that requires a human to manually approve the job run. Besides, it demonstrates how to avoid accidental privilege escalation by employing the principle of least privilege and separating the package build process with reduced privileges from the publishing jobs with elevated privileges that are mandatory for Trusted Publishing to work by being able to access OIDC. As a bonus, this change introduces a job that uploads the dists to GitHub Releases and signs them using Sigstore, which is of special interest as PyPI dropped support for GPG. PR #1261 Refs: * https://github.com/marketplace/actions/pypi-publish#trusted-publishing * https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/ * https://blog.trailofbits.com/2023/05/23/trusted-publishing-a-new-benchmark-for-packaging-security/ * https://docs.pypi.org/trusted-publishers/ * https://blog.pypi.org/posts/2023-05-23-removing-pgp/ * https://www.sigstore.dev
- Loading branch information
Showing
4 changed files
with
235 additions
and
77 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.