Skip to content

Use a trusted (GitHub action) publisher when publishing to PyPi #1922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
flaeppe opened this issue Jan 29, 2024 · 0 comments · Fixed by #1950
Closed

Use a trusted (GitHub action) publisher when publishing to PyPi #1922

flaeppe opened this issue Jan 29, 2024 · 0 comments · Fixed by #1950
Labels
meta Meta-issues and discussion

Comments

@flaeppe
Copy link
Member

flaeppe commented Jan 29, 2024

PyPi quite recently introduced "Trusted publishing" (PyPi's term for OpenID Connect - OIDC standard), which can be used to add a GitHub Actions workflow as trusted publisher in PyPi. That allows for better automation of publishing releases to PyPi that also removes any need for API tokens as GitHub secrets.

Trusted publishing should also integrate into GitHub's environments which can be used for deployments and GitHub allows creating protection rules for deployments. As such it could be possible to e.g. require approvals and/or certain reviewers before deploying to PyPi.

Using trusted publishing should probably reduce the current workload of creating releases while also make it simpler to manage who can do it.

A couple of links with more information:

I could've misinterpreted or got some stuff wrong here, feel free to correct me. I've also set up automatic PyPi releasing for a couple of packages using trusted publishing.

Here's a current .github/workflows/release.yml from https://pypi.org/project/virtualenv/ that could be used as reference:

https://github.com/pypa/virtualenv/blob/fa283474fd199e3836f8b2c99510190c6b77e2bc/.github/workflows/release.yml

@flaeppe flaeppe added the meta Meta-issues and discussion label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Meta-issues and discussion
Development

Successfully merging a pull request may close this issue.

1 participant