| 1 |
name: pypi |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [main] |
| 6 |
tags: |
| 7 |
- "v*" |
| 8 |
|
| 9 |
jobs: |
| 10 |
dist: |
| 11 |
runs-on: ubuntu-latest |
| 12 |
steps: |
| 13 |
- uses: actions/checkout@v7 |
| 14 |
|
| 15 |
- name: Build SDist and wheel |
| 16 |
run: pipx run build |
| 17 |
|
| 18 |
- uses: actions/upload-artifact@v7 |
| 19 |
with: |
| 20 |
path: dist/* |
| 21 |
|
| 22 |
- name: Check metadata |
| 23 |
run: pipx run twine check dist/* |
| 24 |
|
| 25 |
publish: |
| 26 |
needs: [dist] |
| 27 |
runs-on: ubuntu-latest |
| 28 |
if: startsWith(github.ref, 'refs/tags') |
| 29 |
environment: pypi |
| 30 |
permissions: |
| 31 |
id-token: write |
| 32 |
|
| 33 |
steps: |
| 34 |
- uses: actions/download-artifact@v8 |
| 35 |
with: |
| 36 |
name: artifact |
| 37 |
path: dist |
| 38 |
|
| 39 |
- uses: pypa/gh-action-pypi-publish@release/v1 |