| 1 |
on: |
| 2 |
workflow_dispatch: |
| 3 |
release: |
| 4 |
types: |
| 5 |
- published |
| 6 |
|
| 7 |
env: |
| 8 |
DEFAULT_PYTHON: "3.12" |
| 9 |
|
| 10 |
jobs: |
| 11 |
pypi-publish: |
| 12 |
name: Upload release to PyPI |
| 13 |
runs-on: ubuntu-latest |
| 14 |
environment: pypi |
| 15 |
permissions: |
| 16 |
id-token: write |
| 17 |
contents: write |
| 18 |
steps: |
| 19 |
|
| 20 |
- name: Checkout |
| 21 |
uses: actions/checkout@v4 |
| 22 |
with: |
| 23 |
fetch-depth: 0 |
| 24 |
|
| 25 |
- name: Set up Python ${{ env.DEFAULT_PYTHON }} |
| 26 |
id: python |
| 27 |
uses: actions/setup-python@v5 |
| 28 |
with: |
| 29 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 30 |
|
| 31 |
- name: Set up uv |
| 32 |
run: pipx install uv |
| 33 |
|
| 34 |
- name: Install dependencies |
| 35 |
run: | |
| 36 |
uv pip install --system -r pyproject.toml --extra dev |
| 37 |
|
| 38 |
- name: Test |
| 39 |
run: pytest -q |
| 40 |
|
| 41 |
- name: Build package |
| 42 |
run: uv build |
| 43 |
|
| 44 |
- name: Publish package distributions to PyPI |
| 45 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 46 |
|
| 47 |
- name: ✍️ Sign published artifacts |
| 48 |
uses: sigstore/[email protected] |
| 49 |
with: |
| 50 |
inputs: ./dist/*.tar.gz ./dist/*.whl |
| 51 |
release-signing-artifacts: true |