| 1 |
--- |
| 2 |
name: Publish to PyPI |
| 3 |
|
| 4 |
"on": |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- 'master' |
| 8 |
tags: |
| 9 |
- '*' |
| 10 |
workflow_dispatch: |
| 11 |
|
| 12 |
permissions: |
| 13 |
contents: read |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
|
| 18 |
runs-on: ubuntu-latest |
| 19 |
|
| 20 |
environment: release |
| 21 |
permissions: |
| 22 |
id-token: write |
| 23 |
|
| 24 |
steps: |
| 25 |
- uses: actions/checkout@v6 |
| 26 |
- name: Set up Python |
| 27 |
uses: actions/setup-python@v6 |
| 28 |
with: |
| 29 |
python-version: '3.x' |
| 30 |
cache: 'pip' |
| 31 |
- name: Install dependencies |
| 32 |
run: | |
| 33 |
python -m pip install --upgrade pip |
| 34 |
pip install hatch |
| 35 |
- name: Build package |
| 36 |
run: hatch build |
| 37 |
- name: Publish package distributions to PyPI |
| 38 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 39 |
if: github.event_name == 'push' && github.ref_type == 'tag' |