6
6
name : truss-transfer-build-maturin
7
7
8
8
on :
9
- push :
10
- branches :
11
- - main
12
- - master
13
- paths :
14
- - " truss-transfer/**"
15
- tags :
16
- - " *" # Still runs on all tags regardless of directory changes
17
- pull_request :
18
- paths :
19
- - " truss-transfer/**"
20
- workflow_dispatch :
9
+ workflow_call :
10
+ inputs :
11
+ folder :
12
+ description : " The folder containing the package to build."
13
+ required : true
14
+ type : string
15
+ publish_pypi : # New input parameter
16
+ description : " Whether to publish the package to PyPI."
17
+ required : false
18
+ type : boolean
19
+ default : false
20
+ secrets :
21
+ PYPI_TOKEN :
22
+ description : " The PyPI token for publishing."
23
+ required : true # Still required if publish_pypi is true
21
24
22
25
permissions :
23
26
contents : read
48
51
- name : Build wheels
49
52
uses : PyO3/maturin-action@v1
50
53
with :
51
- working-directory : truss-transfer
54
+ working-directory : ${{ inputs.folder }}
52
55
target : ${{ matrix.platform.target }}
53
56
args : --release --out dist --find-interpreter
54
57
sccache : " false"
66
69
uses : PyO3/maturin-action@v1
67
70
if : ${{ matrix.platform.target != 'aarch64' || matrix.platform.target != 'armv7' }}
68
71
with :
69
- working-directory : truss-transfer
72
+ working-directory : ${{ inputs.folder }}
70
73
target : ${{ matrix.platform.target }}
71
74
args : --release --out dist -i python3.13t
72
75
sccache : " false"
86
89
uses : actions/upload-artifact@v4
87
90
with :
88
91
name : wheels-linux-${{ matrix.platform.target }}
89
- path : truss-transfer /dist
92
+ path : ${{ inputs.folder }} /dist
90
93
91
94
musllinux :
92
95
runs-on : ${{ matrix.platform.runner }}
@@ -109,15 +112,15 @@ jobs:
109
112
- name : Build wheels
110
113
uses : PyO3/maturin-action@v1
111
114
with :
112
- working-directory : truss-transfer
115
+ working-directory : ${{ inputs.folder }}
113
116
target : ${{ matrix.platform.target }}
114
117
args : --release --out dist --find-interpreter
115
118
sccache : " false"
116
119
manylinux : musllinux_1_2
117
120
- name : Build free-threaded wheels
118
121
uses : PyO3/maturin-action@v1
119
122
with :
120
- working-directory : truss-transfer
123
+ working-directory : ${{ inputs.folder }}
121
124
target : ${{ matrix.platform.target }}
122
125
args : --release --out dist -i python3.13t
123
126
sccache : " false"
@@ -126,7 +129,7 @@ jobs:
126
129
uses : actions/upload-artifact@v4
127
130
with :
128
131
name : wheels-musllinux-${{ matrix.platform.target }}
129
- path : truss-transfer /dist
132
+ path : ${{ inputs.folder }} /dist
130
133
131
134
windows :
132
135
runs-on : ${{ matrix.platform.runner }}
@@ -146,7 +149,7 @@ jobs:
146
149
- name : Build wheels
147
150
uses : PyO3/maturin-action@v1
148
151
with :
149
- working-directory : truss-transfer
152
+ working-directory : ${{ inputs.folder }}
150
153
target : ${{ matrix.platform.target }}
151
154
args : --release --out dist --find-interpreter
152
155
sccache : " false"
@@ -161,7 +164,7 @@ jobs:
161
164
uses : actions/upload-artifact@v4
162
165
with :
163
166
name : wheels-windows-${{ matrix.platform.target }}
164
- path : truss-transfer /dist
167
+ path : ${{ inputs.folder }} /dist
165
168
166
169
macos :
167
170
runs-on : ${{ matrix.platform.runner }}
@@ -180,22 +183,22 @@ jobs:
180
183
- name : Build wheels
181
184
uses : PyO3/maturin-action@v1
182
185
with :
183
- working-directory : truss-transfer
186
+ working-directory : ${{ inputs.folder }}
184
187
target : ${{ matrix.platform.target }}
185
188
args : --release --out dist --find-interpreter
186
189
sccache : " false"
187
190
- name : Build free-threaded wheels
188
191
uses : PyO3/maturin-action@v1
189
192
with :
190
- working-directory : truss-transfer
193
+ working-directory : ${{ inputs.folder }}
191
194
target : ${{ matrix.platform.target }}
192
195
args : --release --out dist -i python3.13t
193
196
sccache : " false"
194
197
- name : Upload wheels
195
198
uses : actions/upload-artifact@v4
196
199
with :
197
200
name : wheels-macos-${{ matrix.platform.target }}
198
- path : truss-transfer /dist
201
+ path : ${{ inputs.folder }} /dist
199
202
200
203
sdist :
201
204
runs-on : ubuntu-latest
@@ -204,18 +207,20 @@ jobs:
204
207
- name : Build sdist
205
208
uses : PyO3/maturin-action@v1
206
209
with :
207
- working-directory : truss-transfer
210
+ working-directory : ${{ inputs.folder }}
208
211
command : sdist
209
212
args : --out dist
210
213
- name : Upload sdist
211
214
uses : actions/upload-artifact@v4
212
215
with :
213
216
name : wheels-sdist
214
- path : truss-transfer /dist
217
+ path : ${{ inputs.folder }} /dist
215
218
216
219
release :
217
220
name : Release
218
221
runs-on : ubuntu-latest
222
+ # This job will run if triggered by a tag or manually.
223
+ # The decision to publish within this job is now controlled by inputs.publish_pypi
219
224
if : ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
220
225
needs : [linux, musllinux, windows, macos, sdist]
221
226
permissions :
@@ -232,10 +237,10 @@ jobs:
232
237
with :
233
238
subject-path : " wheels-*/*"
234
239
- name : Publish to PyPI
235
- if : ${{ startsWith(github.ref, 'refs/tags/') }}
240
+ if : ${{ inputs.publish_pypi }} # Use the input parameter here
236
241
uses : PyO3/maturin-action@v1
237
242
env :
238
- MATURIN_PYPI_TOKEN : ${{ secrets.TRUSS_TRANSFER_PYPI_API_TOKEN }}
243
+ MATURIN_PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
239
244
with :
240
245
command : upload
241
246
args : --non-interactive --skip-existing wheels-*/*
0 commit comments