Skip to content

Commit c9abedd

Browse files
committed
docs: fix workflow
1 parent f1f92bc commit c9abedd

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

examples/pure-hatch/.github/workflows/release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ jobs:
1717
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1818
with:
1919
persist-credentials: false
20-
- name: Set up Hatch
21-
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc
20+
21+
- name: Setup Python
22+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
23+
with:
24+
python-version: "3.12" # Select the version that you want to build your package on
25+
- name: Upgrade pip, install Hatch, and check Hatch version
26+
run: |
27+
pip install --upgrade pip
28+
pip install --upgrade hatch
29+
hatch --version # Verify that Hatch is installed
2230
- name: Build artifacts
2331
run: hatch build
2432
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

tutorials/trusted-publishing.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Thus, the workflow that you should use should be similar to:
134134

135135
```{literalinclude} ../examples/pure-hatch/.github/workflows/release.yml
136136
:language: yaml
137-
:lines: 1-23
137+
:lines: 1-29
138138
139139
```
140140

@@ -152,7 +152,7 @@ the following to the `release.yaml` file:
152152

153153
```{literalinclude} ../examples/pure-hatch/.github/workflows/release.yml
154154
:language: yaml
155-
:lines: 24-29
155+
:lines: 32-37
156156
157157
```
158158

@@ -170,11 +170,11 @@ build our package, so there is nothing to release.
170170
At this point, if you push the `release.yaml` to GitHub and create a new
171171
release, the GitHub Actions job will:
172172

173-
* run,
174-
* clone your repository,
175-
* install and set up Hatch,
176-
* build your package and
177-
* upload your package as an archive to the artifacts storage.
173+
- run,
174+
- clone your repository,
175+
- install and set up Hatch,
176+
- build your package and
177+
- upload your package as an archive to the artifacts storage.
178178

179179
:::{figure-md} github-actions-release-workflows-run
180180
<img src="../images/tutorials/github-actions-release-workflows-run.png" alt="Graphic showing an example of a release workflow that has just finished running. Each step in the log is matched to one step in the workflow definition." width="700px">
@@ -198,11 +198,13 @@ publishing.
198198

199199
## Configure automatic publishing to PyPI
200200

201-
The job you configured above on GitHub Actions builds a package using your code.
201+
The job you configured above using GitHub Actions builds your package using your code.
202202
You still need to upload it to PyPI. You could upload the package from the same job,
203-
but it is better to create a separate one, to maintain separation of concerns.
204-
This is why in the previous section we uploaded the artifact to the temporary
205-
storage -- in the new job, you will download the package from there and upload it
203+
but it is better to create a separate one to maintain a separation of tasks.
204+
This is why, in the previous section, we uploaded the artifact to the temporary
205+
storage.
206+
207+
In the new job, you will download the package from there and upload it
206208
to PyPI. Since the `build` job does nothing else, there is no possibility that the
207209
package could get compromised before the release.
208210

@@ -211,10 +213,9 @@ package could get compromised before the release.
211213
In the `release.yaml` file, add the following new job, after the job defined in
212214
the previous section:
213215

214-
215216
```{literalinclude} ../examples/pure-hatch/.github/workflows/release.yml
216217
:language: yaml
217-
:lines: 31-46
218+
:lines: 39-54
218219
219220
```
220221

@@ -224,12 +225,13 @@ Remember to change the `url:` to the URL for your package on PyPI!
224225
:::
225226

226227
This job has two steps:
228+
227229
- as discussed above, it uses `download-artifact` to download the artifacts
228230
built in the previous job
229231
- it uses `gh-action-pypi-publish` to publish the package to PyPI.
230232

231-
We are almost there. We just need to enable trusted publishing for the project
232-
and then we are done.
233+
You are almost there!! Now, you just need to enable trusted publishing for the project
234+
on PyPI. And then, your work is done!
233235

234236
### Step 2: Enable trusted publishing on PyPI
235237

@@ -318,7 +320,7 @@ Congratulations. You have now configured your project to do secure releases when
318320

319321
## Footnotes
320322

321-
[^gha]: https://github.com/features/actions
322-
[^changed-files-supply-chain-attack]: https://www.wiz.io/blog/github-action-tj-actions-changed-files-supply-chain-attack-cve-2025-30066
323-
[^dependabot]: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
324-
[^github-artifacts]: https://docs.github.com/en/actions/tutorials/store-and-share-data
323+
[^gha]: <https://github.com/features/actions>
324+
[^changed-files-supply-chain-attack]: <https://www.wiz.io/blog/github-action-tj-actions-changed-files-supply-chain-attack-cve-2025-30066>
325+
[^dependabot]: <https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot>
326+
[^github-artifacts]: <https://docs.github.com/en/actions/tutorials/store-and-share-data>

0 commit comments

Comments
 (0)