21
21
make_sdist :
22
22
name : Make SDist
23
23
runs-on : ubuntu-latest
24
+ permissions :
25
+ # write id-token and attestations are required to attest build provenance
26
+ id-token : write
27
+ attestations : write
24
28
steps :
25
29
- uses : actions/checkout@v4
26
30
with :
31
35
- name : Build SDist
32
36
run : pipx run build --sdist
33
37
38
+ - name : Attest GitHub build provenance
39
+ uses : actions/attest-build-provenance@v1
40
+ with :
41
+ subject-path : dist/*.tar.gz
42
+
34
43
- uses : actions/upload-artifact@v4
35
44
with :
36
45
name : sdist
52
61
build_wheels :
53
62
name : Build wheels for ${{ matrix.platform }}
54
63
runs-on : ${{ matrix.platform }}
64
+ permissions :
65
+ # write id-token and attestations are required to attest build provenance
66
+ id-token : write
67
+ attestations : write
55
68
strategy :
56
69
matrix :
57
70
platform :
67
80
- name : Build wheels
68
81
69
82
83
+ - name : Attest GitHub build provenance
84
+ uses : actions/attest-build-provenance@v1
85
+ with :
86
+ subject-path : ./wheelhouse/*.whl
87
+
70
88
- uses : actions/upload-artifact@v4
71
89
with :
72
90
name : wheels-${{ matrix.platform }}
75
93
build_universal_wheel :
76
94
name : Build universal wheel for Pyodide
77
95
runs-on : ubuntu-latest
96
+ permissions :
97
+ # write id-token and attestations are required to attest build provenance
98
+ id-token : write
99
+ attestations : write
78
100
steps :
79
101
- uses : actions/checkout@v4
80
102
with :
@@ -93,6 +115,11 @@ jobs:
93
115
run : |
94
116
PYODIDE=1 python setup.py bdist_wheel --universal
95
117
118
+ - name : Attest GitHub build provenance
119
+ uses : actions/attest-build-provenance@v1
120
+ with :
121
+ subject-path : dist/*.whl
122
+
96
123
- uses : actions/upload-artifact@v4
97
124
with :
98
125
name : universal_wheel
@@ -129,9 +156,16 @@ jobs:
129
156
130
157
upload_pypi :
131
158
name : Upload to PyPI on release
159
+ # Use the `release` GitHub environment to protect the Trusted Publishing (OIDC)
160
+ # workflow by requiring signoff from a maintainer.
161
+ environment : release
162
+ permissions :
163
+ # write id-token is required for trusted publishing (OIDC)
164
+ id-token : write
132
165
needs : [check_dist]
133
166
runs-on : ubuntu-latest
134
- if : github.event_name == 'release' && github.event.action == 'published'
167
+ # Don't publish from forks
168
+ if : github.repository_owner == 'pymc-devs' && github.event_name == 'release' && github.event.action == 'published'
135
169
steps :
136
170
- uses : actions/download-artifact@v4
137
171
with :
@@ -150,6 +184,4 @@ jobs:
150
184
path : dist
151
185
152
186
153
- with :
154
- user : __token__
155
- password : ${{ secrets.pypi_password }}
187
+ # Implicitly attests that the packages were uploaded in the context of this workflow.
0 commit comments