Skip to content

Bump version

Bump version #19

Workflow file for this run

name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
id-token: write
jobs:
validate-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
- name: Validate version matches tag
run: |
TAG_VERSION=${{ github.ref_name }}
PYPROJECT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
echo "Error: Git tag ($TAG_VERSION) doesn't match pyproject.toml version ($PYPROJECT_VERSION)"
exit 1
fi
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
- name: Install dependencies
run: uv sync --dev
- name: Run type checking
run: uv run mypy .
- name: Run linting
run: uv run ruff check .
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
- name: Install dependencies
run: uv sync --dev --python ${{ matrix.python-version }}
- name: Run tests
run: uv run pytest
build-and-publish:
needs: [validate-version, lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
- name: Build package
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude_types: other,doc,chore,build
- name: Get current date
id: date
run: echo "date=$(date +'%B %-d, %Y')" >> $GITHUB_OUTPUT
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }} (${{ steps.date.outputs.date }})
body: ${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}