@@ -63,11 +63,27 @@ jobs:
6363 id : check-tag
6464 run : |
6565 TAG="${{ steps.version.outputs.version }}"
66+ RELEASE_NAME="${{ steps.version.outputs.release_name }}"
6667 if git rev-parse "refs/tags/${TAG}" >/dev/null 2>&1; then
6768 TAG_SHA=$(git rev-parse "refs/tags/${TAG}^{commit}" 2>/dev/null || git rev-parse "refs/tags/${TAG}")
68- echo "tag_exists=true" >> $GITHUB_OUTPUT
69- echo "tag_sha=${TAG_SHA}" >> $GITHUB_OUTPUT
7069 echo "ℹ️ Tag ${TAG} already exists at commit ${TAG_SHA:0:8}"
70+
71+ # Verify version-bearing files at the tagged commit match the release
72+ TAG_SERVER_VERSION=$(git show "${TAG_SHA}:server/package.json" \
73+ | grep -m1 '"version"' \
74+ | sed 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/')
75+ if [[ "${TAG_SERVER_VERSION}" == "${RELEASE_NAME}" ]]; then
76+ echo "tag_exists=true" >> $GITHUB_OUTPUT
77+ echo "tag_sha=${TAG_SHA}" >> $GITHUB_OUTPUT
78+ echo "✅ Existing tag ${TAG} has correct version (${RELEASE_NAME})"
79+ else
80+ echo "⚠️ Version mismatch at tag ${TAG}: found ${TAG_SERVER_VERSION}, expected ${RELEASE_NAME}"
81+ echo " Removing stale tag to recreate with correct versions..."
82+ git tag -d "${TAG}" 2>/dev/null || true
83+ git push origin ":refs/tags/${TAG}" 2>/dev/null || true
84+ echo "tag_exists=false" >> $GITHUB_OUTPUT
85+ echo "ℹ️ Stale tag ${TAG} removed — will recreate with updated versions"
86+ fi
7187 else
7288 echo "tag_exists=false" >> $GITHUB_OUTPUT
7389 echo "ℹ️ Tag ${TAG} does not exist yet"
@@ -128,8 +144,8 @@ jobs:
128144 # Stage version-bearing files and lockfile changes
129145 git add -A
130146 # Ensure CodeQL-generated artifacts are not staged for commit
131- git restore --staged .codeql || true
132- git restore --staged '*.qlx' || true
147+ git restore --staged .codeql 2>/dev/null || true
148+ git restore --staged '*.qlx' 2>/dev/null || true
133149
134150 # Check if there are changes to commit
135151 if git diff --cached --quiet; then
0 commit comments