11name : Publish on PyPI
22
3- # By default this action does not push to test or production PyPI. The wheels
4- # are available as an artifact that can be downloaded and tested locally.
3+ # By default this action does not push to PyPI. The wheels are available
4+ # as an artifact that can be downloaded and tested locally.
55
66on :
77 workflow_dispatch :
88 inputs :
99 ref :
1010 description : Git ref to publish
11- default : master
1211 type : string
1312 pypi :
1413 description : Publish to PyPI
1514 default : false
1615 type : boolean
17- test_pypi :
18- description : Publish to TestPyPI
19- default : false
20- type : boolean
2116
2217 workflow_call :
2318 inputs :
2419 ref :
2520 description : Git ref to publish
26- default : master
2721 type : string
2822 pypi :
2923 description : Publish to PyPI
3024 default : false
3125 type : boolean
32- test_pypi :
33- description : Publish to TestPyPI
34- default : false
35- type : boolean
3626
3727jobs :
3828 build :
4131 steps :
4232 - uses : actions/checkout@v4
4333 with :
44- ref : ${{ github.event. inputs.ref }}
34+ ref : ${{ inputs.ref }}
4535
4636 - uses : actions/setup-python@v5
4737 with :
@@ -60,13 +50,11 @@ jobs:
6050
6151 upload_pypi :
6252 name : Upload to PyPI (optional)
63- if : github.event. inputs.pypi == 'true'
53+ if : inputs.pypi
6454 needs : build
6555 runs-on : ubuntu-latest
6656 environment :
6757 name : pypi
68- permissions :
69- id-token : write
7058 steps :
7159 - uses : actions/download-artifact@v4
7260 with :
7563
7664 - name : Push to PyPI
7765 uses : pypa/gh-action-pypi-publish@release/v1
78-
79- upload_test_pypi :
80- name : Upload to TestPyPI (optional)
81- if : github.event.inputs.test_pypi == 'true'
82- needs : build
83- runs-on : ubuntu-latest
84- environment :
85- name : testpypi
86- permissions :
87- id-token : write
88- steps :
89- - uses : actions/download-artifact@v4
90- with :
91- name : dist
92- path : dist
93-
94- - name : Push to TestPyPI
95- uses : pypa/gh-action-pypi-publish@release/v1
9666 with :
97- repository-url : https://test.pypi.org/legacy/
67+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments