1919# Trigger: push tag only (e.g. v0.1.0).
2020# Pre-release tags (containing '-') publish to TestPyPI; release tags publish to PyPI.
2121#
22- # Token auth: set repo variable PYPI_USE_TOKEN_AUTH = 'true' and add secrets PYPI_API_TOKEN / TEST_PYPI_API_TOKEN.
23- # Trusted Publishing (OIDC): leave PYPI_USE_TOKEN_AUTH unset; do not pass password so the action uses OIDC.
22+ # Token auth: add secrets PYPI_API_TOKEN / TEST_PYPI_API_TOKEN for publishing.
2423
2524name : Release Python
2625
@@ -149,7 +148,6 @@ jobs:
149148 runs-on : ubuntu-latest
150149 permissions :
151150 contents : read
152- id-token : write
153151 needs : [version-check, sdist, wheels]
154152 if : startsWith(github.ref, 'refs/tags/')
155153 steps :
@@ -159,34 +157,19 @@ jobs:
159157 merge-multiple : true
160158 path : bindings/python/dist
161159
162- - name : Publish to TestPyPI (token)
163- if : contains(github.ref, '-') && vars.PYPI_USE_TOKEN_AUTH == 'true'
164- uses : pypa/gh-action-pypi-publish@release/v1
160+ - name : Publish to TestPyPI
161+ if : contains(github.ref, '-')
162+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
165163 with :
166164 repository-url : https://test.pypi.org/legacy/
167165 skip-existing : true
168166 packages-dir : bindings/python/dist
169167 password : ${{ secrets.TEST_PYPI_API_TOKEN }}
170168
171- - name : Publish to TestPyPI (Trusted Publishing)
172- if : contains(github.ref, '-') && vars.PYPI_USE_TOKEN_AUTH != 'true'
173- uses : pypa/gh-action-pypi-publish@release/v1
174- with :
175- repository-url : https://test.pypi.org/legacy/
176- skip-existing : true
177- packages-dir : bindings/python/dist
178-
179- - name : Publish to PyPI (token)
180- if : ${{ !contains(github.ref, '-') && vars.PYPI_USE_TOKEN_AUTH == 'true' }}
181- uses : pypa/gh-action-pypi-publish@release/v1
169+ - name : Publish to PyPI
170+ if : ${{ !contains(github.ref, '-') }}
171+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
182172 with :
183173 skip-existing : true
184174 packages-dir : bindings/python/dist
185175 password : ${{ secrets.PYPI_API_TOKEN }}
186-
187- - name : Publish to PyPI (Trusted Publishing)
188- if : ${{ !contains(github.ref, '-') && vars.PYPI_USE_TOKEN_AUTH != 'true' }}
189- uses : pypa/gh-action-pypi-publish@release/v1
190- with :
191- skip-existing : true
192- packages-dir : bindings/python/dist
0 commit comments