Loading files
# Release pipeline — builds the package and publishes a GitHub Release with the
# sdist + wheel attached. PyPI publishing is intentionally NOT included yet.
#
# To cut a release:
# 1. Bump `version` in pyproject.toml (run `python tools/sync_version.py` if the
# plugin manifests carry a version), and commit.
# 2. Move CHANGELOG's "## [Unreleased]" heading to "## [X.Y.Z]" — that section
# becomes the GitHub Release body.
# 3. git tag vX.Y.Z && git push origin vX.Y.Z
# The tag (minus the leading "v") must equal the pyproject version or the run fails.
name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch: {}
permissions:
contents: write # create the GitHub Release + upload assets
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
name: build + GitHub Release
runs-on: ubuntu-latest
steps:
- name: Guard — must run on a tag
if: ${{ github.ref_type != 'tag' }}
run: |
echo "::error::This workflow must be triggered by a v* tag (ref_type=${{ github.ref_type }})."
exit 1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Derive + verify version (tag must match pyproject)
id: ver
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
ver="${tag#v}"
py="$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$ver" >> "$GITHUB_OUTPUT"
if [ "$ver" != "$py" ]; then
echo "::error::Tag $tag (version $ver) != pyproject version $py. Bump pyproject + manifests, then re-tag."
exit 1
fi
if printf '%s' "$tag" | grep -q '-'; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Manifest version-sync check
if: ${{ hashFiles('tools/sync_version.py') != '' }}
run: python tools/sync_version.py --check
- name: Build sdist + wheel
run: |
python -m pip install --upgrade build twine
python -m build
twine check dist/*
- name: Extract release notes from CHANGELOG
run: python tools/changelog_extract.py "${{ steps.ver.outputs.version }}" > release-notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.ver.outputs.tag }}
name: ${{ steps.ver.outputs.tag }}
body_path: release-notes.md
prerelease: ${{ steps.ver.outputs.prerelease }}
fail_on_unmatched_files: true
files: |
dist/*.whl
dist/*.tar.gz
476328a26This file is pinned to the selected release. Download the original to open it in your design tool.