|
11 | 11 | # - prerelease == true --> TestPyPI (with skip-existing tolerance) |
12 | 12 | # - prerelease == false --> PyPI production (fail loudly on duplicates) |
13 | 13 | # |
14 | | -# Pre-requisites: |
15 | | -# 1. Create GitHub Environments: "pypi" and "testpypi" |
16 | | -# 2. Configure Trusted Publishers on PyPI/TestPyPI admin panels |
17 | | -# 3. (Recommended) Set "Required reviewers" on "pypi" environment |
| 14 | +# Pre-requisites (choose ONE authentication method): |
| 15 | +# |
| 16 | +# Option A — OIDC Trusted Publishing (recommended, no secrets needed): |
| 17 | +# 1. Create GitHub Environments: "pypi" and "testpypi" |
| 18 | +# 2. Configure Trusted Publishers on PyPI/TestPyPI admin panels |
| 19 | +# 3. (Recommended) Set "Required reviewers" on "pypi" environment |
| 20 | +# |
| 21 | +# Option B — API Token Fallback (simpler initial setup): |
| 22 | +# 1. Set repository secrets: PYPI_API_TOKEN and/or TEST_PYPI_API_TOKEN |
| 23 | +# 2. (Optional) Create "pypi"/"testpypi" environments for deployment guards |
| 24 | +# If environments are not created, remove the `environment:` blocks below. |
18 | 25 | # |
19 | 26 | # References: |
20 | 27 | # [1] https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ |
@@ -102,6 +109,7 @@ jobs: |
102 | 109 | - name: Publish to TestPyPI |
103 | 110 | uses: pypa/gh-action-pypi-publish@release/v1 |
104 | 111 | with: |
| 112 | + password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
105 | 113 | repository-url: https://test.pypi.org/legacy/ |
106 | 114 | skip-existing: true |
107 | 115 |
|
@@ -130,3 +138,5 @@ jobs: |
130 | 138 |
|
131 | 139 | - name: Publish to PyPI |
132 | 140 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 141 | + with: |
| 142 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments