Skip to content

Commit 89d6217

Browse files
committed
🔧 Fix PyPI publishing: Use Trusted Publishing instead of API tokens
- Updated GitHub Actions workflow to use PyPI Trusted Publishing - Removed dependency on PYPI_API_TOKEN secret - Added proper permissions and environment for trusted publishing - This should resolve the PyPI publishing issue
1 parent 950ab71 commit 89d6217

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

‎.github/workflows/publish.yml‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ jobs:
3434
publish:
3535
needs: test
3636
runs-on: ubuntu-latest
37+
environment: pypi # Add environment for trusted publishing
38+
permissions:
39+
id-token: write # Required for trusted publishing
40+
contents: read
3741
steps:
3842
- uses: actions/checkout@v4
3943

@@ -45,28 +49,14 @@ jobs:
4549
- name: Install build dependencies
4650
run: |
4751
python -m pip install --upgrade pip
48-
pip install build twine
52+
pip install build
4953
5054
- name: Build package
5155
run: |
5256
python -m build
5357
54-
- name: Check package
55-
run: |
56-
twine check dist/*
57-
58-
- name: Publish to Test PyPI
59-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
60-
env:
61-
TWINE_USERNAME: __token__
62-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
63-
run: |
64-
twine upload --repository testpypi dist/*
65-
66-
- name: Publish to PyPI
58+
- name: Publish to PyPI (Trusted Publishing)
6759
if: github.event_name == 'release' && github.event.action == 'published'
68-
env:
69-
TWINE_USERNAME: __token__
70-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
71-
run: |
72-
twine upload dist/*
60+
uses: pypa/gh-action-pypi-publish@release/v1
61+
with:
62+
repository-url: https://upload.pypi.org/legacy/

0 commit comments

Comments
 (0)