Skip to content

Commit 15ba70f

Browse files
authored
Switch to using PyPI trusted publishing (#53)
1 parent 4b25d05 commit 15ba70f

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,44 @@ env:
1111
PYTHON_LATEST: "3.11"
1212

1313
jobs:
14-
build_and_publish:
14+
build:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v3
1818
with:
1919
fetch-depth: 0
2020

21-
- name: Set up Python
22-
uses: actions/setup-python@v4
21+
- uses: actions/setup-python@v4
2322
with:
2423
python-version: ${{env.PYTHON_LATEST}}
2524

26-
- name: Install dependencies
25+
- name: ⬇️ Install dependencies
2726
run: |
2827
python -Im pip install --upgrade pip
2928
python -Im pip install wheel
30-
- name: Build
29+
30+
- name: 🏗️ Build
3131
run: python setup.py sdist bdist_wheel
3232

33-
- name: Publish to PyPI
33+
- uses: actions/upload-artifact@v3
34+
with:
35+
path: ./dist
36+
37+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
38+
pypi-publish:
39+
needs: build
40+
environment: 'release'
41+
42+
name: ⬆️ Upload release to PyPI
43+
runs-on: ubuntu-latest
44+
permissions:
45+
# Mandatory for trusted publishing
46+
id-token: write
47+
steps:
48+
- uses: actions/download-artifact@v3
49+
50+
- name: 🚀 Publish package distributions to PyPI
3451
uses: pypa/gh-action-pypi-publish@release/v1
3552
with:
36-
user: '__token__'
37-
password: ${{ secrets.PYPI_API_TOKEN }}
53+
packages-dir: artifact/
54+
print-hash: true

0 commit comments

Comments
 (0)