Skip to content

Commit 8660053

Browse files
committed
guides: remove manual Sigstore steps from publishing guide
These steps are superfluous now that gh-action-pypi-publish generates and uploads PEP 740-compatible attestations by default on its own. (They also served a slightly different purpose than PEP 740 attestations, since they were never uploaded to PyPI and used a different format.) Closes #1788. Signed-off-by: William Woodruff <[email protected]>
1 parent f5c715d commit 8660053

File tree

2 files changed

+11
-83
lines changed

2 files changed

+11
-83
lines changed

source/guides/github-actions-ci-cd-sample/publish-to-test-pypi.yml

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,49 +51,6 @@ jobs:
5151
- name: Publish distribution 📦 to PyPI
5252
uses: pypa/gh-action-pypi-publish@release/v1
5353

54-
github-release:
55-
name: >-
56-
Sign the Python 🐍 distribution 📦 with Sigstore
57-
and upload them to GitHub Release
58-
needs:
59-
- publish-to-pypi
60-
runs-on: ubuntu-latest
61-
62-
permissions:
63-
contents: write # IMPORTANT: mandatory for making GitHub Releases
64-
id-token: write # IMPORTANT: mandatory for sigstore
65-
66-
steps:
67-
- name: Download all the dists
68-
uses: actions/download-artifact@v4
69-
with:
70-
name: python-package-distributions
71-
path: dist/
72-
- name: Sign the dists with Sigstore
73-
uses: sigstore/[email protected]
74-
with:
75-
inputs: >-
76-
./dist/*.tar.gz
77-
./dist/*.whl
78-
- name: Create GitHub Release
79-
env:
80-
GITHUB_TOKEN: ${{ github.token }}
81-
run: >-
82-
gh release create
83-
"$GITHUB_REF_NAME"
84-
--repo "$GITHUB_REPOSITORY"
85-
--notes ""
86-
- name: Upload artifact signatures to GitHub Release
87-
env:
88-
GITHUB_TOKEN: ${{ github.token }}
89-
# Upload to GitHub Release using the `gh` CLI.
90-
# `dist/` contains the built packages, and the
91-
# sigstore-produced signatures and certificates.
92-
run: >-
93-
gh release upload
94-
"$GITHUB_REF_NAME" dist/**
95-
--repo "$GITHUB_REPOSITORY"
96-
9754
publish-to-testpypi:
9855
name: Publish Python 🐍 distribution 📦 to TestPyPI
9956
needs:

source/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows.rst

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ for temporarily storing and downloading the source packages.
2121
details of building platform specific projects. If you have binary
2222
components, check out :ref:`cibuildwheel`'s GitHub Action examples.
2323

24-
Configuring trusted publishing
24+
Configuring Trusted Publishing
2525
==============================
2626

27-
This guide relies on PyPI's `trusted publishing`_ implementation to connect
27+
This guide relies on PyPI's `Trusted Publishing`_ implementation to connect
2828
to `GitHub Actions CI/CD`_. This is recommended for security reasons, since
2929
the generated tokens are created for each of your projects
3030
individually and expire automatically. Otherwise, you'll need to generate an
@@ -36,7 +36,7 @@ Since this guide will demonstrate uploading to both
3636
PyPI and TestPyPI, we'll need two trusted publishers configured.
3737
The following steps will lead you through creating the "pending" publishers
3838
for your new :term:`PyPI project <Project>`.
39-
However it is also possible to add `trusted publishing`_ to any
39+
However it is also possible to add `Trusted Publishing`_ to any
4040
pre-existing project, if you are its owner.
4141

4242
.. attention::
@@ -134,7 +134,7 @@ provided by GitHub Actions. This also defines a GitHub Environment
134134
for the job to run in its context and a URL to be displayed in GitHub's
135135
UI nicely. Additionally, it allows acquiring an OpenID Connect token
136136
that the ``pypi-publish`` actions needs to implement secretless
137-
trusted publishing to PyPI.
137+
Trusted Publishing to PyPI.
138138

139139
.. literalinclude:: github-actions-ci-cd-sample/publish-to-test-pypi.yml
140140
:language: yaml
@@ -152,46 +152,20 @@ Finally, add the following steps at the end:
152152
.. literalinclude:: github-actions-ci-cd-sample/publish-to-test-pypi.yml
153153
:language: yaml
154154
:start-after: id-token: write
155-
:end-before: github-release:
155+
:end-before: publish-to-testpypi:
156156

157157
This step uses the `pypa/gh-action-pypi-publish`_ GitHub
158158
Action: after the stored distribution package has been
159159
downloaded by the `download-artifact`_ action, it uploads
160160
the contents of the ``dist/`` folder into PyPI unconditionally.
161161

162-
Signing the distribution packages
163-
=================================
164-
165-
The following job signs the distribution packages with `Sigstore`_,
166-
the same artifact signing system `used to sign CPython <https://www.python.org/download/sigstore/>`_.
167-
168-
Firstly, it uses the `sigstore/gh-action-sigstore-python GitHub Action`_
169-
to sign the distribution packages. In the next step, an empty GitHub Release
170-
from the current tag is created using the ``gh`` CLI. Note this step can be further
171-
customised. See the `gh release documentation <https://cli.github.com/manual/gh_release>`_
172-
as a reference.
173-
174162
.. tip::
175163

176-
You may need to manage your ``GITHUB_TOKEN`` permissions to
177-
enable creating the GitHub Release. See the `GitHub
178-
documentation <https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions>`_
179-
for instructions. Specifically, the token needs the
180-
``contents: write`` permission.
181-
182-
Finally, the signed distributions are uploaded to the GitHub Release.
183-
184-
.. literalinclude:: github-actions-ci-cd-sample/publish-to-test-pypi.yml
185-
:language: yaml
186-
:start-at: github-release:
187-
:end-before: publish-to-testpypi
188-
189-
190-
.. note::
191-
192-
This is a replacement for GPG signatures, for which support has been
193-
`removed from PyPI <https://blog.pypi.org/posts/2023-05-23-removing-pgp/>`_.
194-
However, this job is not mandatory for uploading to PyPI and can be omitted.
164+
Starting with version
165+
`v1.11.0 <https://github.com/pypa/gh-action-pypi-publish/releases/tag/v1.11.0>`_,
166+
`pypa/gh-action-pypi-publish`_ generates and uploads :pep:`740`-compatible
167+
attestations for each distribution by default. No additional manual
168+
signing steps are required.
195169

196170

197171
Separate workflow for publishing to TestPyPI
@@ -254,9 +228,6 @@ sure that your release pipeline remains healthy!
254228
https://github.com/actions/download-artifact
255229
.. _`upload-artifact`:
256230
https://github.com/actions/upload-artifact
257-
.. _Sigstore: https://www.sigstore.dev/
258-
.. _`sigstore/gh-action-sigstore-python GitHub Action`:
259-
https://github.com/marketplace/actions/gh-action-sigstore-python
260231
.. _Secrets:
261232
https://docs.github.com/en/actions/reference/encrypted-secrets
262-
.. _trusted publishing: https://docs.pypi.org/trusted-publishers/
233+
.. _Trusted Publishing: https://docs.pypi.org/trusted-publishers/

0 commit comments

Comments
 (0)