Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,30 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify tag is on its release branch
# A tag created from the GitHub Releases UI can land on the default branch instead of the selected one (#4620)
run: |
set -euo pipefail
major="${GITHUB_REF_NAME#v}"
major="${major%%.*}"
status=0
git ls-remote --exit-code --heads origin "release/${major}.x" > /dev/null || status=$?
# Exit code 2 means no matching branch; anything else is a failed lookup
if [ "$status" -eq 0 ]; then
branch="release/${major}.x"
elif [ "$status" -eq 2 ]; then
branch="main"
else
echo "::error::Could not look up release/${major}.x (git ls-remote exit code ${status})"
exit 1
fi
git fetch --no-tags origin "+refs/heads/${branch}:refs/remotes/origin/${branch}"
if ! git merge-base --is-ancestor "$GITHUB_SHA" "origin/${branch}"; then
echo "::error::Tag ${GITHUB_REF_NAME} (${GITHUB_SHA}) is not on ${branch}. Delete the tag and recreate it on ${branch}."
exit 1
fi
echo "Tag ${GITHUB_REF_NAME} is on ${branch}"
shell: bash
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
Expand Down
Loading