Deploy to PyPI using trusted publishing#603
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #603 +/- ##
=======================================
Coverage 91.66% 91.66%
=======================================
Files 6 6
Lines 1944 1944
=======================================
Hits 1782 1782
Misses 162 162 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Update: I've sent an email to @segfault. |
|
Can do |
|
Done. Sorry for the lag. Missed the initial email notification. |
|
No problem, and thank you! |
After updating cibiuldwheel (#604), it successfully uploaded to TestPyPI via trusted publishing 🚀
So I've also:
So we should all be set for whenever we next want a prod release. |
|
@hugovk FYI building in the same job as uploading opens up a possibility for privilege escalation through build dependency poisoning, that's why it's recommended to build in a separate job. Besides, it would be useful to build the platform-specific wheels from sdist and not from a Git checkout. |
|
What privilege would be higher than poisoning the wheels we build?
What makes you say that? |
GitHub's OIDC token can eventually let someone access services other, than PyPI. That's why, while working on the secretless publishing in my pypi-publish action during the private beta, we wanted explicitly ask that people separate the jobs. My PyPUG guide caught up with that recommendation a bit later: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/.
That's kinda tribal knowledge, partially. But essentially, that's what If you don't build from sdist, you may end up shipping a tarball that doesn't contain all the necessary bits for building+install wheels from it. What's present in Git isn't necessarily a part of sdist. Also, this helps make sdists usable by the downstreams. Distro packagers mostly use sdists from PyPI to repackage RPMs and similar, treating them as the buildable source.
Additionally, I have a GitHub Action to support using sdists in CI instead of a Git checkout, to improve the downstream compatibility even more — https://github.com/marketplace/actions/checkout-python-sdist. |

Follow on from #594:
I emailed Jonas Tarnstrom, one of the former maintainers, and he's given me access so I've now set up trusted publishing for this project at https://pypi.org/manage/project/ujson/settings/publishing/:
We should have the same thing on TestPyPI too: @segfault, I think you initially set up https://test.pypi.org/project/ujson/? Please could you give me owner access there too? Thanks!
TODO
hugovkowner at https://test.pypi.org/project/ujson/TEST_PYPI_PASSWORDfrom https://github.com/ultrajson/ultrajson/settings/secrets/actionsPYPI_PASSWORDfrom https://github.com/ultrajson/ultrajson/settings/secrets/actionsujson-ghatoken from my account at https://test.pypi.org/manage/account/ujson-ghatoken from my account at https://pypi.org/manage/account/