From bc38f99b166c451f9a51e90ccd87a276a3e3d272 Mon Sep 17 00:00:00 2001 From: dariocazzani Date: Sun, 3 May 2026 17:34:24 -0400 Subject: [PATCH] Accept prerelease tags matching pyproject base version - Tag validation previously required exact match between tag version and pyproject.toml version, which broke the documented dry-run flow: v0.1.0rc1 against pyproject.toml=0.1.0. - Now tags are accepted when they either match pyproject.toml exactly (final release) or are a prerelease (a/b/rc suffix) of the version declared in pyproject.toml. - Keeps the intent: pyproject.toml is the source of truth for the target version; prerelease suffixes are dry-run variants of it. --- .github/workflows/release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e386b7..519c380 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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