From 4d918ce2c0133dcef0267f64ea07d13924bff130 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 20:57:55 +0000 Subject: [PATCH 1/2] Add workflow to check versions match release tag (#217) Fails when Directory.Build.props, the Blazor csproj, or the MAUI csproj (Version and ApplicationDisplayVersion) don't match the v* tag. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01AMesZ45rYbUa63fA5MZDio --- .github/workflows/check-release-version.yml | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/check-release-version.yml diff --git a/.github/workflows/check-release-version.yml b/.github/workflows/check-release-version.yml new file mode 100644 index 0000000..504fb9c --- /dev/null +++ b/.github/workflows/check-release-version.yml @@ -0,0 +1,69 @@ +name: Check Release Version + +# Fails when the version numbers in the project files don't match the release tag. +# Reminder to bump versions before tagging a release. + +on: + push: + tags: + - 'v*' + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: 'Tag to check against (e.g. v1.4.5)' + required: true + +permissions: + contents: read + +jobs: + check-version: + runs-on: ubuntu-latest + name: Versions match tag + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Compare versions to tag + env: + TAG: ${{ github.event.inputs.tag || github.event.release.tag_name || github.ref_name }} + run: | + EXPECTED="${TAG#v}" + echo "Release tag: $TAG (expected version: $EXPECTED)" + echo + + # file|element pairs to check + CHECKS=( + "Directory.Build.props|Version" + "src/NoteBookmark.BlazorApp/NoteBookmark.BlazorApp.csproj|Version" + "src/NoteBookmark.MauiApp/NoteBookmark.MauiApp.csproj|Version" + "src/NoteBookmark.MauiApp/NoteBookmark.MauiApp.csproj|ApplicationDisplayVersion" + ) + + FAILED=0 + for check in "${CHECKS[@]}"; do + FILE="${check%%|*}" + ELEMENT="${check##*|}" + ACTUAL=$(grep -oPm1 "(?<=<${ELEMENT}>)[^<]+" "$FILE" || true) + + if [ -z "$ACTUAL" ]; then + echo "::error file=$FILE::<$ELEMENT> not found in $FILE" + FAILED=1 + elif [ "$ACTUAL" != "$EXPECTED" ]; then + echo "::error file=$FILE::<$ELEMENT> is $ACTUAL but the tag is $TAG" + echo "❌ $FILE <$ELEMENT> = $ACTUAL" + FAILED=1 + else + echo "✅ $FILE <$ELEMENT> = $ACTUAL" + fi + done + + echo + if [ "$FAILED" -ne 0 ]; then + echo "Version mismatch: update the files above to $EXPECTED before releasing $TAG." + exit 1 + fi + echo "All versions match $TAG." From 15de04ac9ae6748ca8b41e7cbf1f981630d74bd5 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 12:51:41 +0000 Subject: [PATCH 2/2] Check out the requested tag on manual version checks Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01AMesZ45rYbUa63fA5MZDio --- .github/workflows/check-release-version.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check-release-version.yml b/.github/workflows/check-release-version.yml index 504fb9c..ea21cd6 100644 --- a/.github/workflows/check-release-version.yml +++ b/.github/workflows/check-release-version.yml @@ -26,6 +26,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + # Manual runs inspect the requested tag; automatic runs keep the event's commit + ref: ${{ github.event.inputs.tag || '' }} - name: Compare versions to tag env: