Skip to content

Commit 6ea9175

Browse files
authored
Merge pull request #82 from ThreeFish-AI/vk/41ee-github-actions-w
ci(github-actions): 新增 PyPI 发布 API Token 回退认证模式
2 parents 1ff1e74 + 734aa19 commit 6ea9175

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
# - prerelease == true --> TestPyPI (with skip-existing tolerance)
1212
# - prerelease == false --> PyPI production (fail loudly on duplicates)
1313
#
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.
1825
#
1926
# References:
2027
# [1] https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
@@ -102,6 +109,7 @@ jobs:
102109
- name: Publish to TestPyPI
103110
uses: pypa/gh-action-pypi-publish@release/v1
104111
with:
112+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
105113
repository-url: https://test.pypi.org/legacy/
106114
skip-existing: true
107115

@@ -130,3 +138,5 @@ jobs:
130138

131139
- name: Publish to PyPI
132140
uses: pypa/gh-action-pypi-publish@release/v1
141+
with:
142+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)