From 1f0f99d29fbdd0b91bbad3f038f83bbf9eb8893a Mon Sep 17 00:00:00 2001 From: Pierre Quinton Date: Mon, 2 Mar 2026 18:32:16 +0100 Subject: [PATCH] ci: add version consistency check before PyPI publish --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 919c259e..ffbb09af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,27 @@ on: types: [published] jobs: + check-version: + name: Verify version matches tag + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Extract and compare versions + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + TOML_VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") + + if [ "$TAG_VERSION" != "$TOML_VERSION" ]; then + echo "Version mismatch: tag is v$TAG_VERSION, pyproject.toml is $TOML_VERSION" + exit 1 + fi + echo "Versions match: $TOML_VERSION" + pypi-publish: name: Publish to PyPI + needs: check-version environment: release runs-on: ubuntu-latest permissions: