Skip to content

Use (test)pypi in Trusted Publishing placeholder for GitHub Environments #17036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/user/trusted-publishers/adding-a-publisher.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ each.

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ provide the name of the PyPI project that will be created.

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

![Image showing adding a new GitHub publisher](/assets/trusted-publishing/github/pending-publisher-form-filled.png)
Expand Down
2 changes: 1 addition & 1 deletion docs/user/trusted-publishers/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ In the context of trusted publishing, the machinery is as follows:

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

* When applicable, PyPI also checks claims that prevent
Expand Down
4 changes: 2 additions & 2 deletions docs/user/trusted-publishers/using-a-publisher.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ below describe the setup process for each supported trusted publisher.
name: upload release to PyPI
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
Expand All @@ -46,7 +46,7 @@ below describe the setup process for each supported trusted publisher.
name: upload release to PyPI
runs-on: ubuntu-latest
+ # Specifying a GitHub environment is optional, but strongly encouraged
+ environment: release
+ environment: pypi
+ permissions:
+ # IMPORTANT: this permission is mandatory for trusted publishing
+ id-token: write
Expand Down
13 changes: 6 additions & 7 deletions warehouse/locale/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4481,13 +4481,6 @@ msgstr ""
msgid "(optional)"
msgstr ""

#: warehouse/templates/manage/account/publishing.html:118
#: warehouse/templates/manage/account/publishing.html:224
#: warehouse/templates/manage/project/publishing.html:109
#: warehouse/templates/manage/project/publishing.html:201
msgid "release"
msgstr ""

#: warehouse/templates/manage/account/publishing.html:124
#: warehouse/templates/manage/project/publishing.html:115
#, python-format
Expand Down Expand Up @@ -4575,6 +4568,12 @@ msgid ""
"pipelines are not supported)."
msgstr ""

#: warehouse/templates/manage/account/publishing.html:224
#: warehouse/templates/manage/project/publishing.html:109
#: warehouse/templates/manage/project/publishing.html:201
msgid "release"
msgstr ""

#: warehouse/templates/manage/account/publishing.html:226
#: warehouse/templates/manage/project/publishing.html:203
#, python-format
Expand Down
2 changes: 1 addition & 1 deletion warehouse/templates/manage/account/publishing.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
{% endif %}
</label>
{{ pending_github_publisher_form.environment(
placeholder=gettext("release"),
placeholder="testpypi" if testPyPI else "pypi",
class_="form-group__field",
autocomplete="off",
aria_describedby="environment-errors",
Expand Down