replaces build backend with uv and automates release. #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| build_package: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1 | |
| - name: Check tag matches pyproject.toml version | |
| run: | | |
| TAG_VERSION="${GITHUB_REF##*/}" | |
| TAG_VERSION_NO_PREFIX="${TAG_VERSION#v}" | |
| echo "Tag version: $TAG_VERSION (stripped: $TAG_VERSION_NO_PREFIX)" | |
| PYPROJECT_VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| echo "pyproject.toml version: $PYPROJECT_VERSION" | |
| if [ "$TAG_VERSION_NO_PREFIX" != "$PYPROJECT_VERSION" ]; then | |
| echo "Tag version ($TAG_VERSION_NO_PREFIX) does not match pyproject.toml version ($PYPROJECT_VERSION)" >&2 | |
| exit 1 | |
| fi | |
| shell: bash | |
| - name: Build package | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| - name: Upload Python artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: python-dist | |
| path: dist/ | |
| create_release: | |
| runs-on: ubuntu-latest | |
| needs: build_package | |
| steps: | |
| - name: Download Python artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: python-dist | |
| path: dist/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2 | |
| with: | |
| files: | | |
| dist/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |