diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84413d3..72aaedf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,22 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Verify Cargo.toml version matches git tag + shell: bash + run: | + TAG_VERSION="${GITHUB_REF_NAME}" + + CARGO_VERSION=$(grep '^version\s*=' Cargo.toml | head -n1 | sed -E 's/version\s*=\s*"([^"]+)"/\1/') + + echo "Git tag version: $TAG_VERSION" + echo "Cargo.toml version: $CARGO_VERSION" + + if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then + echo "::error::Version mismatch! Git tag ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)" + exit 1 + fi + + - name: Install Rust uses: actions-rs/toolchain@v1 with: