File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,24 +39,17 @@ jobs:
3939 pypi :
4040 runs-on : ubuntu-latest
4141 needs : release
42- # Publishes only when a PyPI token secret is configured (skipped otherwise).
43- if : ${{ github.event_name == 'push' }}
42+ # Publishes via PyPI Trusted Publishing (OIDC) — no token/secret required.
43+ permissions :
44+ id-token : write
4445 steps :
4546 - uses : actions/checkout@v4
4647 - uses : actions/setup-python@v5
4748 with :
4849 python-version : " 3.12"
49- - name : Build
50+ - name : Build wheel + sdist
5051 run : |
51- python -m pip install --upgrade pip build twine
52+ python -m pip install --upgrade pip build
5253 python -m build
53- - name : Publish to PyPI (token)
54- env :
55- TWINE_USERNAME : __token__
56- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
57- run : |
58- if [ -n "$TWINE_PASSWORD" ]; then
59- twine upload --non-interactive dist/*
60- else
61- echo "PYPI_API_TOKEN not set — skipping PyPI publish."
62- fi
54+ - name : Publish to PyPI (Trusted Publishing)
55+ uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments