File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1010 publish :
1111 runs-on : ubuntu-latest
1212 permissions :
13- id-token : write
13+ contents : read
1414
1515 steps :
1616 - name : Checkout
2929 twine check dist/*
3030
3131 - name : Publish to PyPI
32+ if : ${{ secrets.PYPI_API_TOKEN != '' }}
3233 uses : pypa/gh-action-pypi-publish@release/v1
3334 with :
3435 password : ${{ secrets.PYPI_API_TOKEN }}
36+
37+ - name : Skip PyPI publish (token not configured)
38+ if : ${{ secrets.PYPI_API_TOKEN == '' }}
39+ run : |
40+ echo "PYPI_API_TOKEN is not set. Skipping package upload."
41+ echo "To enable publish, add PYPI_API_TOKEN in repo Settings -> Secrets and variables -> Actions."
Original file line number Diff line number Diff line change 77- Replace ` <YOUR_HANDLE> ` in launch copies.
88- (Optional) Replace security email in ` SECURITY.md ` .
99
10+ ## 0.5) Choose PyPI publish mode
11+
12+ Option A (simplest): API token
13+
14+ - In PyPI, create an API token (project-scoped recommended).
15+ - In GitHub repo: ` Settings -> Secrets and variables -> Actions `
16+ - Add secret: ` PYPI_API_TOKEN `
17+
18+ Option B: Trusted Publisher (OIDC)
19+
20+ - Configure Trusted Publisher on PyPI for this exact repo/workflow.
21+ - If claims do not match, you'll see ` invalid-publisher ` .
22+ - This repository currently defaults to API token mode.
23+
1024## 1) Final local checks
1125
1226``` bash
You can’t perform that action at this time.
0 commit comments