@@ -21,10 +21,10 @@ for temporarily storing and downloading the source packages.
21
21
details of building platform specific projects. If you have binary
22
22
components, check out :ref: `cibuildwheel `'s GitHub Action examples.
23
23
24
- Configuring trusted publishing
24
+ Configuring Trusted Publishing
25
25
==============================
26
26
27
- This guide relies on PyPI's `trusted publishing `_ implementation to connect
27
+ This guide relies on PyPI's `Trusted Publishing `_ implementation to connect
28
28
to `GitHub Actions CI/CD `_. This is recommended for security reasons, since
29
29
the generated tokens are created for each of your projects
30
30
individually and expire automatically. Otherwise, you'll need to generate an
@@ -36,7 +36,7 @@ Since this guide will demonstrate uploading to both
36
36
PyPI and TestPyPI, we'll need two trusted publishers configured.
37
37
The following steps will lead you through creating the "pending" publishers
38
38
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
40
40
pre-existing project, if you are its owner.
41
41
42
42
.. attention ::
@@ -134,7 +134,7 @@ provided by GitHub Actions. This also defines a GitHub Environment
134
134
for the job to run in its context and a URL to be displayed in GitHub's
135
135
UI nicely. Additionally, it allows acquiring an OpenID Connect token
136
136
that the ``pypi-publish `` actions needs to implement secretless
137
- trusted publishing to PyPI.
137
+ Trusted Publishing to PyPI.
138
138
139
139
.. literalinclude :: github-actions-ci-cd-sample/publish-to-test-pypi.yml
140
140
:language: yaml
@@ -152,46 +152,20 @@ Finally, add the following steps at the end:
152
152
.. literalinclude :: github-actions-ci-cd-sample/publish-to-test-pypi.yml
153
153
:language: yaml
154
154
:start-after: id-token: write
155
- :end-before: github-release :
155
+ :end-before: publish-to-testpypi :
156
156
157
157
This step uses the `pypa/gh-action-pypi-publish `_ GitHub
158
158
Action: after the stored distribution package has been
159
159
downloaded by the `download-artifact `_ action, it uploads
160
160
the contents of the ``dist/ `` folder into PyPI unconditionally.
161
161
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
-
174
162
.. tip ::
175
163
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.
195
169
196
170
197
171
Separate workflow for publishing to TestPyPI
@@ -254,9 +228,6 @@ sure that your release pipeline remains healthy!
254
228
https://github.com/actions/download-artifact
255
229
.. _`upload-artifact` :
256
230
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
260
231
.. _Secrets :
261
232
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