Skip to content

Commit c7b7b88

Browse files
committed
Fix instructions for GitLab CI with Trusted Publishing
1 parent 2da3278 commit c7b7b88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/user/trusted-publishers/using-a-publisher.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ below describe the setup process for each supported trusted publisher.
305305
- build-job
306306
id_tokens:
307307
PYPI_ID_TOKEN:
308+
# Use "testpypi" if uploading to TestPyPI
308309
aud: pypi
309310
script:
310311
# Install dependencies
@@ -313,9 +314,11 @@ below describe the setup process for each supported trusted publisher.
313314

314315
# Retrieve the OIDC token from GitLab CI/CD, and exchange it for a PyPI API token
315316
- oidc_token=$(python -m id PYPI)
317+
# Replace "https://pypi.org/*" with "https://test.pypi.org/*" if uploading to TestPyPI
316318
- resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\":\"${oidc_token}\"}")
317-
- api_token=$(jq '.token' <<< "${resp}")
319+
- api_token=$(jq --raw-output '.token' <<< "${resp}")
318320

319321
# Upload to PyPI authenticating via the newly-minted token
322+
# Add "--repository testpypi" if uploading to TestPyPI
320323
- twine upload -u __token__ -p "${api_token}" python_pkg/dist/*
321324
```

0 commit comments

Comments
 (0)