@@ -6,19 +6,15 @@ name: Upload Python Package
66
77on :
88 release :
9- types : [created ]
9+ types : [published ]
1010
1111jobs :
12- pypi-publish :
12+ release-build :
1313 runs-on : ubuntu-latest
14-
15- environment :
16- name : pypi
17- url : https://pypi.org/project/tldr/
18-
1914 permissions :
2015 contents : read
21- id-token : write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher
16+ attestations : write # to upload assets attestation of 'dists' for build provenance
17+ id-token : write # grant additional permission to attestation action to mint the OIDC token permission
2218
2319 steps :
2420 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -29,40 +25,57 @@ jobs:
2925 python-version : ' 3.9'
3026
3127 - name : Install sphinx toolset
32- run : >-
33- python -m
34- pip install
35- sphinx
36- sphinx-argparse
37- --user
28+ run :
29+ python -m pip install sphinx sphinx-argparse --user
3830
3931 - name : Install tldr dependencies
40- run : >-
41- python -m
42- pip install
43- -r
44- requirements.txt
45- --user
32+ run :
33+ python -m pip install -r requirements.txt --user
4634
4735 - name : Generate the manpage
4836 working-directory : docs
4937 run : make man
5038
5139 - name : Install pep517
52- run : >-
53- python -m
54- pip install
55- pep517
56- --user
40+ run :
41+ python -m pip install pep517 --user
5742
5843 - name : Build a binary wheel and a source tarball
5944 run : >-
60- python -m
61- pep517.build
45+ python -m pep517.build
6246 --source
6347 --binary
6448 --out-dir dist/
6549 .
6650
51+ - name : Attest generated files
52+ uses : actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
53+ with :
54+ subject-path : dist/
55+
56+ - name : Upload release distributions
57+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
58+ with :
59+ name : release-dists
60+ path : dist/
61+
62+ pypi-publish :
63+ runs-on : ubuntu-latest
64+ needs : ['release-build']
65+
66+ environment :
67+ name : pypi
68+ url : https://pypi.org/project/tldr/
69+
70+ permissions :
71+ id-token : write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher
72+
73+ steps :
74+ - name : Retrieve release distributions
75+ uses : actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
76+ with :
77+ name : release-dists
78+ path : dist/
79+
6780 - name : Publish package
6881 uses : pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
0 commit comments