Skip to content
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

[task] Upgrade .github/workflows/pypi_upload.yml to use Trusted Publishing #4589

Open
webknjaz opened this issue Feb 24, 2025 · 0 comments
Open

Comments

@webknjaz
Copy link

webknjaz commented Feb 24, 2025

          any reason you didn't migrate to Trusted Publishing? It can produce digital attestations out of the box now: https://blog.pypi.org/posts/2024-11-14-pypi-now-supports-digital-attestations/.

Originally posted by @webknjaz in #4512 (comment)

          We should move to Trusted Publishing at some point, but that's a bit more work, so we'll do it when we do it I suppose. I'd probably accept a PR that does it for us.

Originally posted by @JelleZijlstra in #4512 (comment)

The full guide is @ https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/.

Example of CI/CD setup that uploads individual dists as GHA workflow artifacts in cibuildwheel (and pure-python fallback) jobs with unique artifact names, and then downloads them in the publishing job: https://github.com/aio-libs/yarl/blob/426b7ac/.github/workflows/ci-cd.yml#L112-L124 + https://github.com/aio-libs/yarl/blob/426b7ac/.github/workflows/reusable-build-wheel.yml#L93-L100 + https://github.com/aio-libs/yarl/blob/426b7ac/.github/workflows/ci-cd.yml#L553-L558.

Roughly, this is what needs to be done:

  • add uploading artifacts into each job producing them
  • ensure that the artifact names are unique per single workflow run
  • add downloading all of them and merging contents of multiple artifacts into a single dir, into the PyPI upload job
  • Change twine upload to invoking pypi-publish
  • Add OIDC permission to the PyPI job
  • Add an environment called pypi to the job and set up required reviewers for said environment in the repo settings
  • Get somebody with the Owner-level permissions to configure trust on the PyPI side
@webknjaz webknjaz changed the title Upgrade[task] .github/workflows/pypi_upload.yml to use Trusted Publishing [task] Upgrade .github/workflows/pypi_upload.yml to use Trusted Publishing Feb 24, 2025
@webknjaz webknjaz moved this to 🗒️ Backlog 📝 in 📅 Procrastinating in public Feb 24, 2025
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

No branches or pull requests

1 participant