Backport No Tag

This commit is contained in:
Yuhong Sun 2024-10-27 16:19:59 -07:00
parent e8dfed959e
commit 2a6c032883

View File

@ -1,5 +1,7 @@
name: Backport on Merge
# Note this workflow does not trigger the builds, be sure to manually tag the branches to trigger the builds
on:
pull_request:
types: [closed] # Later we check for merge so only PRs that go in can get backported
@ -72,29 +74,33 @@ jobs:
run: |
set -e
echo "Backporting to beta ${{ steps.list-branches.outputs.beta }} and stable ${{ steps.list-branches.outputs.stable }}"
# Fetch all history for all branches and tags
git fetch --prune
# Checkout the beta branch
# Prepare the beta branch
git checkout ${{ steps.list-branches.outputs.beta }}
# Cherry-pick the merge commit from the merged PR
git cherry-pick -m 1 ${{ github.event.pull_request.merge_commit_sha }} || {
echo "Cherry-pick to beta failed due to conflicts."
exit 1
}
# Create new beta tag
# Create new beta branch/tag
git tag ${{ steps.list-branches.outputs.new_beta_tag }}
# Push the changes and tag to the beta branch using PAT
git push origin ${{ steps.list-branches.outputs.beta }} --force
git push origin ${{ steps.list-branches.outputs.new_beta_tag }}
# Checkout the stable branch
#git push origin ${{ steps.list-branches.outputs.new_beta_tag }} # This step does not trigger the workflow, better to do it manually for now
# Prepare the stable branch
git checkout ${{ steps.list-branches.outputs.stable }}
# Cherry-pick the merge commit from the merged PR
git cherry-pick -m 1 ${{ github.event.pull_request.merge_commit_sha }} || {
echo "Cherry-pick to stable failed due to conflicts."
exit 1
}
# Create new stable tag
# Create new stable branch/tag
git tag ${{ steps.list-branches.outputs.new_stable_tag }}
# Push the changes and tag to the stable branch using PAT
git push origin ${{ steps.list-branches.outputs.stable }} --force
git push origin ${{ steps.list-branches.outputs.new_stable_tag }}
#git push origin ${{ steps.list-branches.outputs.new_stable_tag }} # This step does not trigger the workflow, better to do it manually for now