From aaa130315b23088c7644bedd68f8ab0e4332a618 Mon Sep 17 00:00:00 2001 From: Glenn Fiedler Date: Fri, 10 Jul 2026 01:47:24 -0400 Subject: [PATCH] Add release version check workflow Fails the tag build if a release tag does not match the version recorded in the repo, so a release can't ship with stale version metadata (as netcode v1.3.2 did with its CMake project version). Co-Authored-By: Claude Fable 5 --- .github/workflows/release-check.yml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/release-check.yml diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml new file mode 100644 index 0000000..dffbb89 --- /dev/null +++ b/.github/workflows/release-check.yml @@ -0,0 +1,38 @@ +name: Release Check + +on: + push: + tags: [ 'v*' ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + version-check: + name: tag matches project version + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Check release version + run: | + cmake_version=$(sed -nE 's/^project\(netcode VERSION ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CMakeLists.txt) + if [ -z "$cmake_version" ]; then + echo "::error::Could not extract the project version from CMakeLists.txt" + exit 1 + fi + echo "CMakeLists.txt project version: $cmake_version" + case "$GITHUB_REF" in + refs/tags/*) + tag_version="${GITHUB_REF_NAME#v}" + echo "Release tag version: $tag_version" + if [ "$tag_version" != "$cmake_version" ]; then + echo "::error::Tag $GITHUB_REF_NAME does not match project(netcode VERSION $cmake_version) in CMakeLists.txt — bump the CMake project version as part of the release." + exit 1 + fi + ;; + *) + echo "Not a tag build, nothing more to check." + ;; + esac