From 2ba9fb17afeb66e70240e9070e6e82f6e7b9ccc3 Mon Sep 17 00:00:00 2001 From: Michael Shaffer Date: Sun, 29 Mar 2026 12:49:50 -0400 Subject: [PATCH] Enhance release workflow with tag checks and summaries Add error handling for existing Git tags and update release summary messages. --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee57f1d..730c703 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -107,6 +107,16 @@ jobs: git commit -m "chore: bump manifest to ${VERSION} for ${TAG}" git push -u origin "$BRANCH" + git fetch origin --tags + HEAD_SHA=$(git rev-parse HEAD) + if git show-ref --verify --quiet "refs/tags/${TAG}"; then + TAG_SHA=$(git rev-parse "${TAG}^{}" 2>/dev/null || git rev-parse "refs/tags/${TAG}") + if [ "$TAG_SHA" != "$HEAD_SHA" ]; then + echo "::error::Git tag \`${TAG}\` already exists and points to \`${TAG_SHA}\`, but \`${BRANCH}\` HEAD is \`${HEAD_SHA}\`. On GitHub delete the \`${TAG}\` tag and any release tied to it (Releases → … → Delete), then re-run this workflow, or use a higher version." + exit 1 + fi + fi + EXTRA=( ) if [ "$INPUT_DRAFT" = "true" ]; then EXTRA+=(--draft); fi if [ "$INPUT_PRERELEASE" = "true" ]; then EXTRA+=(--prerelease); fi @@ -123,3 +133,19 @@ jobs: --head "$BRANCH" \ --title "Merge ${TAG} manifest bump" \ --body "Automated manifest bump for [${TAG}](https://github.com/${{ github.repository }}/releases/tag/${TAG}). Merge after checks pass so \`${DEFAULT_BRANCH}\` matches the release." + + - name: Summary + if: success() + env: + BRANCH: ${{ needs.normalize.outputs.branch }} + TAG: ${{ needs.normalize.outputs.tag }} + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + run: | + { + echo "## Create release" + echo "The manifest bump lives on branch **\`${BRANCH}\`**, not on **\`${DEFAULT_BRANCH}\`** until you **merge the pull request** from this run." + echo "" + echo "If \`${DEFAULT_BRANCH}\` still shows the old version, open **Pull requests** and merge the PR titled **Merge ${TAG} manifest bump**." + echo "" + echo "**Draft releases** use a temporary \`untagged-…\` URL in the job log until you **Publish** the release on GitHub; then the normal \`/releases/tag/${TAG}\` link applies." + } >> "$GITHUB_STEP_SUMMARY"