Skip to content

Commit 195a0d2

Browse files
committed
Use Trusted Publishing for uploads to PyPI
1 parent 65bb7c5 commit 195a0d2

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,15 @@ jobs:
114114
# ... and all build jobs completed successfully
115115
needs: [build_wheels, build_aarch64_wheels]
116116
runs-on: ubuntu-latest
117+
permissions:
118+
# Required for trusted publishing to PyPI
119+
id-token: write
120+
# Required for creating GitHub releases
121+
contents: write
117122
steps:
118123
- uses: actions/checkout@v4
119124
with:
120125
submodules: recursive
121-
- name: Set up Python
122-
uses: actions/setup-python@v5
123-
with:
124-
python-version: "3.x"
125-
- name: Install dependencies
126-
run: |
127-
python -m pip install --upgrade pip
128-
pip install --upgrade setuptools wheel twine
129126
- name: Download artifacts from build jobs
130127
uses: actions/download-artifact@v4
131128
with:
@@ -160,15 +157,7 @@ jobs:
160157
body_path: "${{ runner.temp }}/release_notes.md"
161158
draft: false
162159
prerelease: ${{ env.IS_PRERELEASE }}
163-
- name: Build and publish
164-
env:
165-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
166-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
167-
run: |
168-
if [ "$IS_PRERELEASE" == true ]; then
169-
echo "DEBUG: This is a pre-release"
170-
else
171-
echo "DEBUG: This is a final release"
172-
fi
173-
python setup.py sdist
174-
twine upload dist/*
160+
- name: Build source distribution
161+
run: pipx run build --sdist
162+
- name: Publish to PyPI
163+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)