| 1 |
name: Release |
| 2 |
|
| 3 |
on: |
| 4 |
release: |
| 5 |
types: [published] |
| 6 |
|
| 7 |
env: |
| 8 |
DEFAULT_PYTHON: 3.11 |
| 9 |
|
| 10 |
jobs: |
| 11 |
build: |
| 12 |
name: Build PyPI package |
| 13 |
runs-on: ubuntu-latest |
| 14 |
|
| 15 |
permissions: |
| 16 |
contents: read |
| 17 |
|
| 18 |
steps: |
| 19 |
- name: Checkout the repository |
| 20 |
uses: actions/[email protected] |
| 21 |
with: |
| 22 |
ref: ${{ github.event.release.target_commitish }} |
| 23 |
|
| 24 |
- name: Set up UV and Python |
| 25 |
uses: astral-sh/setup-uv@v7 |
| 26 |
with: |
| 27 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 28 |
enable-cache: true |
| 29 |
cache-dependency-glob: "uv.lock" |
| 30 |
|
| 31 |
- name: Install the project |
| 32 |
run: uv sync --all-groups |
| 33 |
|
| 34 |
- name: Run tests |
| 35 |
run: | |
| 36 |
uv run pytest |
| 37 |
|
| 38 |
- name: Build package |
| 39 |
run: | |
| 40 |
uv build |
| 41 |
|
| 42 |
- name: Store the distribution packages |
| 43 |
uses: actions/upload-artifact@v5 |
| 44 |
with: |
| 45 |
name: python-package-distributions |
| 46 |
path: dist/ |
| 47 |
|
| 48 |
publish: |
| 49 |
name: Publish to PyPI 📦 |
| 50 |
needs: |
| 51 |
- build |
| 52 |
runs-on: ubuntu-latest |
| 53 |
|
| 54 |
permissions: |
| 55 |
id-token: write |
| 56 |
|
| 57 |
environment: |
| 58 |
name: pypi |
| 59 |
url: https://pypi.org/p/asusrouter |
| 60 |
|
| 61 |
steps: |
| 62 |
- name: Download all the dists |
| 63 |
uses: actions/download-artifact@v6 |
| 64 |
with: |
| 65 |
name: python-package-distributions |
| 66 |
path: dist/ |
| 67 |
- name: Publish to PyPI |
| 68 |
uses: pypa/gh-action-pypi-publish@release/v1 |