Skip to content

Commit 234b18c

Browse files
chryslesirosenwebknjaz
committed
Address more review comments
Co-authored-by: Stephen Rosen <[email protected]> Co-authored-by: Sviatoslav Sydorenko <[email protected]>
1 parent c406f51 commit 234b18c

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: Set up Python
1313
uses: actions/setup-python@v4
1414
with:
@@ -36,7 +36,7 @@ jobs:
3636
runs-on: ubuntu-latest
3737
environment:
3838
name: pypi
39-
# Fill in your project (e.g. repository) name for <package-name>
39+
# Replace <package-name> below with your PyPI project name:
4040
url: https://pypi.org/p/<package-name>
4141
permissions:
4242
id-token: write # IMPORTANT: mandatory for trusted publishing
@@ -76,11 +76,11 @@ jobs:
7676
./dist/*.whl
7777
- name: Upload artifact signatures to GitHub Release
7878
env:
79-
GH_TOKEN: ${{ github.token }}
79+
GITHUB_TOKEN: ${{ github.token }}
8080
# Upload to GitHub Release using the `gh` CLI.
8181
# `dist/` contains the built packages, and the
8282
# sigstore-produced signatures and certificates.
83-
run: gh release upload "${{ github.ref_name }}" dist/** --repo "${{ github.repository }}"
83+
run: gh release upload "${{ github.ref_name }}" dist/**
8484

8585
publish-to-testpypi:
8686
name: Publish Python 🐍 distribution 📦 to TestPyPI

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ Let's begin! 🚀
5252
2. Fill in the name you wish to publish your new
5353
:term:`PyPI project <Project>` under
5454
(the ``name`` value in your ``setup.cfg`` or ``pyproject.toml``),
55-
the GitHub repository owner's name (org or user)
56-
and repository name and the name of the release workflow file under
55+
the GitHub repository owner's name (org or user),
56+
and repository name, and the name of the release workflow file under
5757
the ``.github/`` folder, see :ref:`workflow-definition`.
58-
Finally add the name of the GitHub Actions environment
58+
Finally, add the name of the GitHub Environment
5959
(``pypi``) we're going set up under your repository.
6060
Register the trusted publisher.
6161
3. Now, go to https://test.pypi.org/manage/account/publishing/ and repeat
62-
the second step, but now enter ``testpypi`` as the name of the
63-
GitHub Actions environment.
62+
the second step, but this time, enter ``testpypi`` as the name of the
63+
GitHub Environment.
6464
4. Your "pending" publishers are now ready for their first use and will
6565
create your projects automatically once you use them
6666
for the first time.
@@ -71,9 +71,9 @@ Let's begin! 🚀
7171
create it. It's not the same as a regular PyPI account.
7272

7373

74-
.. hint::
74+
.. attention::
7575

76-
For security reasons, you should require manual approval
76+
For security reasons, you must require `manual approval <https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules>`_
7777
on each run for the ``pypi`` environment.
7878

7979

@@ -140,7 +140,7 @@ trusted publishing to PyPI.
140140
:end-before: steps:
141141

142142
This will also ensure that the PyPI publishing workflow is only triggered
143-
if the current commit is tagged. It is recommended you use the
143+
if the current commit is tagged. It is recommended that you commit using the
144144
latest release tag.
145145

146146
Publishing the distribution to PyPI
@@ -161,9 +161,11 @@ the contents of the ``dist/`` folder into PyPI unconditionally.
161161
Signing the distribution packages
162162
=================================
163163

164-
This additional job signs the distribution packages with `Sigstore`_,
165-
using the `sigstore/gh-action-sigstore-python GitHub Action`_,
166-
and then uploads them to GitHub Release.
164+
The following job signs the distribution packages with `Sigstore`_,
165+
the same artifact signing system `used to sign CPython <https://www.python.org/download/sigstore/>`_.
166+
167+
It uses the `sigstore/gh-action-sigstore-python GitHub Action`_,
168+
and then uploads them to a GitHub Release.
167169

168170
.. literalinclude:: github-actions-ci-cd-sample/publish-to-test-pypi.yml
169171
:language: yaml
@@ -174,8 +176,8 @@ and then uploads them to GitHub Release.
174176
.. note::
175177

176178
This is a replacement for GPG signatures, for which support has been
177-
`removed <https://blog.pypi.org/posts/2023-05-23-removing-pgp/>`_ by PyPI.
178-
However, this job is not mandatory for defining the workflow.
179+
`removed from PyPI <https://blog.pypi.org/posts/2023-05-23-removing-pgp/>`_.
180+
However, this job is not mandatory for uploading to PyPI and can be omitted.
179181

180182

181183
Separate workflow for publishing to TestPyPI
@@ -189,6 +191,11 @@ section:
189191
:language: yaml
190192
:start-at: publish-to-testpypi
191193

194+
.. tip::
195+
196+
Requiring manual approvals in the ``testpypi`` GitHub Environment is typically unnecessary as it's designed to run on each commit to the main branch and is often used to indicate a healthy release publishing pipeline.
197+
198+
192199
The whole CI/CD workflow
193200
========================
194201

0 commit comments

Comments
 (0)