fix: remove auto-delete of source branch (footgun for non-ephemeral sources like master)

Amp-Thread-ID: https://ampcode.com/threads/T-019e042d-d972-7559-b462-6e838c2da164
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Jedrzej Kosinski 2026-05-08 15:15:53 -07:00
parent a8e11936f3
commit 3566e6b6a6

View File

@ -2,11 +2,14 @@ name: Cut Release
# Promote a prepared "candidate" branch (cherry-picks + version bump
# already committed) into a real release: create the canonical
# `release/v<version>` branch, create the `v<version>` annotated tag, and
# (on success) delete the candidate branch.
# `release/v<version>` branch and the `v<version>` annotated tag at the
# candidate's HEAD, atomically.
#
# After this runs, kick off `release-stable-all.yml` manually with the new
# tag to build portable artifacts — same as previous backports.
#
# The candidate branch is left in place; clean it up manually once you've
# verified the release.
on:
workflow_dispatch:
@ -30,7 +33,7 @@ on:
type: string
default: ''
dry_run:
description: 'Validate only — do not push branch, tag, or delete source'
description: 'Validate only — do not push branch or tag'
required: false
type: boolean
default: false
@ -217,15 +220,6 @@ jobs:
"${SOURCE_SHA}:refs/heads/${REL_BRANCH}" \
"refs/tags/${TAG_NAME}"
- name: Delete source branch (success only)
if: success() && inputs.dry_run != true && inputs.dry_run != 'true'
env:
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }}
run: |
set -euo pipefail
AUTH_URL="https://x-access-token:${GH_TOKEN}@github.com/${REPO_FULL}.git"
git push "$AUTH_URL" --delete "refs/heads/${INPUT_SOURCE_BRANCH}"
- name: Final summary
if: always()
env:
@ -237,13 +231,15 @@ jobs:
echo ""
echo "### Result"
if [ "$INPUT_DRY_RUN" = "true" ]; then
echo "🔍 **Dry run** — no branch, tag, or deletion was performed."
echo "🔍 **Dry run** — no branch or tag was created."
else
echo "✅ Promoted \`$INPUT_SOURCE_BRANCH\` to \`$REL_BRANCH\` and tagged \`$TAG_NAME\`."
echo "✅ Created \`$REL_BRANCH\` and tagged \`$TAG_NAME\` from \`$INPUT_SOURCE_BRANCH\`."
echo ""
echo "- Branch: <https://github.com/${REPO_FULL}/tree/${REL_BRANCH}>"
echo "- Tag: <https://github.com/${REPO_FULL}/releases/tag/${TAG_NAME}>"
echo ""
echo "Next: run [release-stable-all.yml](https://github.com/${REPO_FULL}/actions/workflows/release-stable-all.yml) with \`git_tag=${TAG_NAME}\`."
echo ""
echo "The candidate branch \`$INPUT_SOURCE_BRANCH\` was left in place; delete it manually once you've verified the release."
fi
} >> "$GITHUB_STEP_SUMMARY"