Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ jobs:
set -euo pipefail
tag="${GITHUB_REF#refs/tags/}"
version="${tag#v}"
base_version="${version%%[abr]*}" # strip a1/b1/rc1 suffix if present
echo "Tag: $tag"
echo "Version from tag: $version"
echo "Base version: $base_version"

pyproject_version=$(uv run --no-sync python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
echo "Version in pyproject.toml: $pyproject_version"

if [ "$version" != "$pyproject_version" ]; then
echo "::error::Tag version ($version) does not match pyproject.toml version ($pyproject_version)"
# Tag must either match pyproject.toml exactly (final release) OR be a
# prerelease (a/b/rc) of the version declared in pyproject.toml. This
# lets us dry-run v0.1.0rc1 before tagging v0.1.0 without bumping
# pyproject.toml churn.
if [ "$version" != "$pyproject_version" ] && [ "$base_version" != "$pyproject_version" ]; then
echo "::error::Tag version ($version) is not a release of pyproject.toml version ($pyproject_version)"
exit 1
fi

Expand Down
Loading