Skip to content

Merge development to main #15

Merge development to main

Merge development to main #15

Workflow file for this run

name: CI & Publish (PyPI + Release)
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
# Publish only when a version tag is pushed
tags:
- '[0-9]*'
permissions:
contents: write # For creating the release
id-token: write # Required for PyPI Trusted Publisher
actions: read
jobs:
test-and-lint:
name: Test & Lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up UV
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cache UV
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
- name: Sync dev dependencies
run: uv sync --locked --all-extras --dev --no-progress -q
- name: Run tests
run: uv run pytest
- name: Lint / Format / Type-check
run: uv run lint
publish:
name: Publish to PyPI & Create GitHub Release
runs-on: ubuntu-latest
needs: [ test-and-lint ]
# Runs only if on a version tag (e.g., refs/tags/1.2.3)
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout (full history for changelog/tools)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up UV (publish runtime)
uses: astral-sh/setup-uv@v6
with:
python-version: "3.13"
- name: Sync dev dependencies
run: uv sync --locked --all-extras --dev --no-progress -q
- name: Lint / Format / Type-check
run: |
uv run lint
uv run pytest
- name: Build sdist & wheel with uv
run: uv build
# Publication via OIDC (Trusted Publisher) – no secret required on GitHub side
- name: Publish to PyPI
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: uv publish --verbose
# GitHub Release with auto notes + attached artifacts (sdist/wheel)
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
files: |
dist/*.whl
dist/*.tar.gz