| 1 |
name: Publish to PyPI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
tags: ['v[0-9]*.[0-9]*.[0-9]*'] |
| 6 |
|
| 7 |
permissions: |
| 8 |
contents: read |
| 9 |
|
| 10 |
jobs: |
| 11 |
tests: |
| 12 |
uses: ./.github/workflows/tests.yml |
| 13 |
|
| 14 |
build: |
| 15 |
needs: tests |
| 16 |
runs-on: ubuntu-latest |
| 17 |
steps: |
| 18 |
- uses: actions/checkout@v4 |
| 19 |
- uses: actions/setup-python@v5 |
| 20 |
with: |
| 21 |
python-version: '3.11' |
| 22 |
- name: Build sdist + wheel |
| 23 |
run: | |
| 24 |
python -m pip install --upgrade pip build |
| 25 |
python -m build |
| 26 |
- name: Check artifacts |
| 27 |
run: | |
| 28 |
python -m pip install twine |
| 29 |
twine check dist/* |
| 30 |
- uses: actions/upload-artifact@v4 |
| 31 |
with: |
| 32 |
name: dist |
| 33 |
path: dist/ |
| 34 |
|
| 35 |
publish: |
| 36 |
needs: build |
| 37 |
runs-on: ubuntu-latest |
| 38 |
permissions: |
| 39 |
id-token: write |
| 40 |
steps: |
| 41 |
- uses: actions/download-artifact@v4 |
| 42 |
with: |
| 43 |
name: dist |
| 44 |
path: dist/ |
| 45 |
- uses: pypa/[email protected] |