This commit is contained in:
Yuhong Sun
2024-10-27 19:12:31 -07:00
parent 9270782c49
commit 4c417b5e3e

View File

@@ -71,19 +71,11 @@ jobs:
set -e set -e
echo "Backporting to beta ${{ steps.list-branches.outputs.beta }} and stable ${{ steps.list-branches.outputs.stable }}" echo "Backporting to beta ${{ steps.list-branches.outputs.beta }} and stable ${{ steps.list-branches.outputs.stable }}"
# Echo the merge commit SHA
echo "Merge commit SHA: ${{ github.event.pull_request.merge_commit_sha }}"
# Fetch all history for all branches and tags # Fetch all history for all branches and tags
git fetch --prune git fetch --prune
# Reset and prepare the beta branch # Prepare the beta branch
git checkout ${{ steps.list-branches.outputs.beta }} git checkout ${{ steps.list-branches.outputs.beta }}
git reset --hard origin/${{ steps.list-branches.outputs.beta }}
echo "Last 5 commits on beta branch:"
git log -n 5 --pretty=format:"%H"
# Cherry-pick the merge commit from the merged PR
git cherry-pick -m 1 ${{ github.event.pull_request.merge_commit_sha }} || { git cherry-pick -m 1 ${{ github.event.pull_request.merge_commit_sha }} || {
echo "Cherry-pick to beta failed due to conflicts." echo "Cherry-pick to beta failed due to conflicts."
exit 1 exit 1
@@ -92,15 +84,11 @@ jobs:
# Create new beta branch/tag # Create new beta branch/tag
git tag ${{ steps.list-branches.outputs.new_beta_tag }} git tag ${{ steps.list-branches.outputs.new_beta_tag }}
# Push the changes and tag to the beta branch using PAT # Push the changes and tag to the beta branch using PAT
git push origin ${{ steps.list-branches.outputs.beta }} git push origin ${{ steps.list-branches.outputs.beta }} --force
git push origin ${{ steps.list-branches.outputs.new_beta_tag }} #git push origin ${{ steps.list-branches.outputs.new_beta_tag }} # This step does not trigger the workflow, better to do it manually for now
# Reset and prepare the stable branch # Prepare the stable branch
git checkout ${{ steps.list-branches.outputs.stable }} git checkout ${{ steps.list-branches.outputs.stable }}
git reset --hard origin/${{ steps.list-branches.outputs.stable }}
echo "Last 5 commits on stable branch:"
git log -n 5 --pretty=format:"%H"
# Cherry-pick the merge commit from the merged PR # Cherry-pick the merge commit from the merged PR
git cherry-pick -m 1 ${{ github.event.pull_request.merge_commit_sha }} || { git cherry-pick -m 1 ${{ github.event.pull_request.merge_commit_sha }} || {
echo "Cherry-pick to stable failed due to conflicts." echo "Cherry-pick to stable failed due to conflicts."
@@ -110,5 +98,5 @@ jobs:
# Create new stable branch/tag # Create new stable branch/tag
git tag ${{ steps.list-branches.outputs.new_stable_tag }} git tag ${{ steps.list-branches.outputs.new_stable_tag }}
# Push the changes and tag to the stable branch using PAT # Push the changes and tag to the stable branch using PAT
git push origin ${{ steps.list-branches.outputs.stable }} 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