Skip to content

Commit 6d60f0e

Browse files
webknjazwoodruffwdi
authored
Use (test)pypi in Trusted Publishing placeholder for GitHub Environments (#17036)
* Use `(test)pypi` in Trusted Publishing placeholder for GitHub Environments GitHub Environments is a confusingly explained feature within GitHub that represents deployment targets. When projects get uploaded to PyPI — that a deployment target; same for TestPyPI. They don't represent processes but server-like entities. So using `release` is conceptually incorrect and gives people the wrong idea of what it is. This is actually connected to Deployments API (and corresponding events) on the GitHub platform. The name Environments is just a misleading interface to describe Deployments that appears in some parts of the ecosystem, like GitHub Actions CI/CD. In other places, it's called deployments and there's even a tab in repositories using it: https://github.com/cherrypy/cheroot/deployments/pypi. Each deployment can be linked to the corresponding released project version URL. This patch attempts to align the practices with those used in the PyPUG guide and GitHub docs: actions/starter-workflows#2345. * Suggest `pypi` GitHub Environment @ `adding-a-publisher.md` doc * Suggest `pypi` GitHub Environment @ `creating-a-project-through-oidc.md` doc * Suggest `pypi` GitHub Environment @ `internals.md` doc * Suggest `pypi` GitHub Environment @ `using-a-publisher.md` doc * `make translations` Signed-off-by: William Woodruff <[email protected]> --------- Signed-off-by: William Woodruff <[email protected]> Co-authored-by: William Woodruff <[email protected]> Co-authored-by: Dustin Ingram <[email protected]>
1 parent ac0dee9 commit 6d60f0e

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

docs/user/trusted-publishers/adding-a-publisher.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ each.
3232

3333
For example, if you have a project at `https://github.com/octo-org/sampleproject`
3434
that uses a publishing workflow defined in `.github/workflows/release.yml`
35-
and a custom environment named `release`, then you'd do the following:
35+
and a custom environment named `pypi`, then you'd do the following:
3636

3737
![Image showing adding a new GitHub publisher](/assets/trusted-publishing/github/project-publishing-form.png)
3838

docs/user/trusted-publishers/creating-a-project-through-oidc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ provide the name of the PyPI project that will be created.
3838

3939
If you have a repository at
4040
`https://github.com/octo-org/sampleproject` with a release workflow at
41-
`release.yml` and an environment named `release` that you would like to publish
41+
`release.yml` and an environment named `pypi` that you would like to publish
4242
to PyPI as `sampleproject`, then you would do the following:
4343

4444
![Image showing adding a new GitHub publisher](/assets/trusted-publishing/github/pending-publisher-form-filled.png)

docs/user/trusted-publishers/internals.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ In the context of trusted publishing, the machinery is as follows:
3838

3939
* For example, a trusted publisher configuration for GitHub Actions might
4040
specify `repo: octo-org/example` with `workflow: release.yml` and
41-
`environment: release`, indicating that a presented OIDC token **must**
41+
`environment: pypi`, indicating that a presented OIDC token **must**
4242
contain exactly those claims to be considered valid.
4343

4444
* When applicable, PyPI also checks claims that prevent

docs/user/trusted-publishers/using-a-publisher.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ below describe the setup process for each supported trusted publisher.
2626
name: upload release to PyPI
2727
runs-on: ubuntu-latest
2828
# Specifying a GitHub environment is optional, but strongly encouraged
29-
environment: release
29+
environment: pypi
3030
permissions:
3131
# IMPORTANT: this permission is mandatory for trusted publishing
3232
id-token: write
@@ -46,7 +46,7 @@ below describe the setup process for each supported trusted publisher.
4646
name: upload release to PyPI
4747
runs-on: ubuntu-latest
4848
+ # Specifying a GitHub environment is optional, but strongly encouraged
49-
+ environment: release
49+
+ environment: pypi
5050
+ permissions:
5151
+ # IMPORTANT: this permission is mandatory for trusted publishing
5252
+ id-token: write

warehouse/locale/messages.pot

+6-7
Original file line numberDiff line numberDiff line change
@@ -4481,13 +4481,6 @@ msgstr ""
44814481
msgid "(optional)"
44824482
msgstr ""
44834483

4484-
#: warehouse/templates/manage/account/publishing.html:118
4485-
#: warehouse/templates/manage/account/publishing.html:224
4486-
#: warehouse/templates/manage/project/publishing.html:109
4487-
#: warehouse/templates/manage/project/publishing.html:201
4488-
msgid "release"
4489-
msgstr ""
4490-
44914484
#: warehouse/templates/manage/account/publishing.html:124
44924485
#: warehouse/templates/manage/project/publishing.html:115
44934486
#, python-format
@@ -4575,6 +4568,12 @@ msgid ""
45754568
"pipelines are not supported)."
45764569
msgstr ""
45774570

4571+
#: warehouse/templates/manage/account/publishing.html:224
4572+
#: warehouse/templates/manage/project/publishing.html:109
4573+
#: warehouse/templates/manage/project/publishing.html:201
4574+
msgid "release"
4575+
msgstr ""
4576+
45784577
#: warehouse/templates/manage/account/publishing.html:226
45794578
#: warehouse/templates/manage/project/publishing.html:203
45804579
#, python-format

warehouse/templates/manage/account/publishing.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
{% endif %}
116116
</label>
117117
{{ pending_github_publisher_form.environment(
118-
placeholder=gettext("release"),
118+
placeholder="testpypi" if testPyPI else "pypi",
119119
class_="form-group__field",
120120
autocomplete="off",
121121
aria_describedby="environment-errors",

0 commit comments

Comments
 (0)