7878 TORCHOPT_NO_EXTENSIONS : " true"
7979
8080 - name : Upload artifact
81- uses : actions/upload-artifact@v3
81+ uses : actions/upload-artifact@v4
8282 with :
8383 name : build
8484 path : dist/*
@@ -97,12 +97,13 @@ jobs:
9797 make pytest
9898
9999 build-wheels-py38 :
100- name : Build wheels for Python ${{ matrix.python-version }} on ubuntu-latest
101- runs-on : ubuntu-latest
100+ name : Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.os }}
101+ runs-on : ${{ matrix.os }}
102102 needs : [build]
103103 if : github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/'))
104104 strategy :
105105 matrix :
106+ os : [ubuntu-latest]
106107 python-version : ["3.8"] # sync with requires-python in pyproject.toml
107108 fail-fast : false
108109 timeout-minutes : 60
@@ -140,19 +141,20 @@ jobs:
140141 output-dir : wheelhouse
141142 config-file : " {package}/pyproject.toml"
142143
143- - uses : actions/upload-artifact@v3
144+ - uses : actions/upload-artifact@v4
144145 with :
145- name : wheels-py38
146+ name : wheels-${{ matrix.python-version }}-${{ matrix.os }}
146147 path : wheelhouse/*.whl
147148 if-no-files-found : error
148149
149150 build-wheels :
150- name : Build wheels for Python ${{ matrix.python-version }} on ubuntu-latest
151- runs-on : ubuntu-latest
151+ name : Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.os }}
152+ runs-on : ${{ matrix.os }}
152153 needs : [build, build-wheels-py38]
153154 if : github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/'))
154155 strategy :
155156 matrix :
157+ os : [ubuntu-latest]
156158 python-version : ["3.9", "3.10", "3.11"] # sync with requires-python in pyproject.toml
157159 fail-fast : false
158160 timeout-minutes : 60
@@ -190,15 +192,47 @@ jobs:
190192 output-dir : wheelhouse
191193 config-file : " {package}/pyproject.toml"
192194
193- - uses : actions/upload-artifact@v3
195+ - uses : actions/upload-artifact@v4
194196 with :
195- name : wheels
197+ name : wheels-${{ matrix.python-version }}-${{ matrix.os }}
196198 path : wheelhouse/*.whl
197199 if-no-files-found : error
198200
199- publish :
201+ list-artifacts :
202+ name : List artifacts
200203 runs-on : ubuntu-latest
201204 needs : [build, build-wheels-py38, build-wheels]
205+ if : github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/'))
206+ timeout-minutes : 15
207+ steps :
208+ - name : Download built sdist
209+ uses : actions/download-artifact@v4
210+ with :
211+ # unpacks default artifact into dist/
212+ # if `name: artifact` is omitted, the action will create extra parent dir
213+ name : build
214+ path : dist
215+
216+ - name : Download built wheels
217+ uses : actions/download-artifact@v4
218+ with :
219+ pattern : wheels-*
220+ path : dist
221+ merge-multiple : true
222+
223+ - name : List distributions
224+ run : ls -lh dist/*
225+
226+ - name : Upload artifacts
227+ uses : actions/upload-artifact@v4
228+ with :
229+ name : artifacts
230+ path : dist/*
231+ if-no-files-found : error
232+
233+ publish :
234+ runs-on : ubuntu-latest
235+ needs : [list-artifacts]
202236 if : |
203237 github.repository == 'metaopt/torchopt' && github.event_name != 'pull_request' &&
204238 (github.event_name != 'workflow_dispatch' || github.event.inputs.task == 'build-and-publish') &&
@@ -236,28 +270,12 @@ jobs:
236270 exit 1
237271 fi
238272
239- - name : Download built sdist
240- uses : actions/download-artifact@v3
241- with :
242- # unpacks default artifact into dist/
243- # if `name: artifact` is omitted, the action will create extra parent dir
244- name : build
245- path : dist
246-
247- - name : Download built wheels
248- uses : actions/download-artifact@v3
249- with :
250- # unpacks default artifact into dist/
251- # if `name: artifact` is omitted, the action will create extra parent dir
252- name : wheels-py38
253- path : dist
254-
255- - name : Download built wheels
256- uses : actions/download-artifact@v3
273+ - name : Download built artifacts
274+ uses : actions/download-artifact@v4
257275 with :
258276 # unpacks default artifact into dist/
259277 # if `name: artifact` is omitted, the action will create extra parent dir
260- name : wheels
278+ name : artifacts
261279 path : dist
262280
263281 - name : List distributions
@@ -269,10 +287,10 @@ jobs:
269287 with :
270288 user : __token__
271289 password : ${{ secrets.TESTPYPI_UPLOAD_TOKEN }}
272- repository_url : https://test.pypi.org/legacy/
290+ repository-url : https://test.pypi.org/legacy/
273291 verbose : true
274- print_hash : true
275- skip_existing : true
292+ print-hash : true
293+ skip-existing : true
276294
277295 - name : Publish to PyPI
278296 if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
@@ -281,5 +299,5 @@ jobs:
281299 user : __token__
282300 password : ${{ secrets.PYPI_UPLOAD_TOKEN }}
283301 verbose : true
284- print_hash : true
285- skip_existing : true
302+ print-hash : true
303+ skip-existing : true
0 commit comments