File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
docs/user/trusted-publishers Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,7 @@ below describe the setup process for each supported trusted publisher.
292
292
stage: build
293
293
image: python:3-bookworm
294
294
script:
295
- - python -m pip install -U twine build
295
+ - python -m pip install -U build
296
296
- cd python_pkg && python -m build
297
297
artifacts:
298
298
paths:
@@ -305,6 +305,7 @@ below describe the setup process for each supported trusted publisher.
305
305
- build-job
306
306
id_tokens:
307
307
PYPI_ID_TOKEN:
308
+ # Use "testpypi" if uploading to TestPyPI
308
309
aud: pypi
309
310
script:
310
311
# Install dependencies
@@ -313,9 +314,11 @@ below describe the setup process for each supported trusted publisher.
313
314
314
315
# Retrieve the OIDC token from GitLab CI/CD, and exchange it for a PyPI API token
315
316
- oidc_token=$(python -m id PYPI)
317
+ # Replace "https://pypi.org/*" with "https://test.pypi.org/*" if uploading to TestPyPI
316
318
- 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}")
318
320
319
321
# Upload to PyPI authenticating via the newly-minted token
322
+ # Add "--repository testpypi" if uploading to TestPyPI
320
323
- twine upload -u __token__ -p "${api_token}" python_pkg/dist/*
321
324
```
You can’t perform that action at this time.
0 commit comments