2020 description : Which PyPI environment to upload to, if any
2121 required : true
2222 type : choice
23- options : ["none", "testpypi", "pypi"]
23+ options : ["none", "chain", " testpypi", "pypi"]
2424
2525concurrency :
2626 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -225,7 +225,7 @@ jobs:
225225
226226 testpypi-publish :
227227 name : Publish release to TestPyPI
228- if : github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
228+ if : github.event_name == 'workflow_dispatch' && ( github.event.inputs.environment == 'testpypi' || github.event.inputs.environment == 'chain')
229229 runs-on : ubuntu-latest
230230 needs : [build_wheels, build_sdist]
231231 environment :
@@ -255,7 +255,7 @@ jobs:
255255 name : Nightly upload
256256 if : github.repository == 'scikit-learn/scikit-learn-release' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'none'))
257257 runs-on : ubuntu-latest
258- needs : [build_wheels]
258+ needs : [build_wheels, build_sdist ]
259259
260260 steps :
261261 - name : Download sdist and wheels
@@ -282,9 +282,22 @@ jobs:
282282
283283 pypi-publish :
284284 name : Publish release to PyPI
285- if : github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
285+ if : >-
286+ github.event_name == 'workflow_dispatch'
287+ && (
288+ github.event.inputs.environment == 'pypi'
289+ || (
290+ github.event.inputs.environment == 'chain'
291+ && (needs.testpypi-publish.result == 'success' || needs.testpypi-publish.result == 'skipped')
292+ )
293+ )
286294 runs-on : ubuntu-latest
287- needs : [build_wheels, build_sdist]
295+ # environment:
296+ # name: pypi
297+ # url: https://pypi.org/p/scikit-learn
298+ # permissions:
299+ # id-token: write # mandatory for trusted publishing
300+ needs : [build_wheels, build_sdist, testpypi-publish]
288301 environment :
289302 name : pypi
290303 url : https://pypi.org/p/scikit-learn
0 commit comments