add backport script (#19331)

This commit is contained in:
Gary Verhaegen 2024-06-04 19:16:03 +02:00 committed by GitHub
parent 79929ac266
commit 91c1c216f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

27
sdk/bin/backport-all Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$DIR/.."
if [ -n "$(git status --porcelain)" ]; then
echo "Working tree not clean, not doing anything."
#exit 1
fi
cherry=$(git rev-parse ${1:-HEAD})
for v in 3.0 2.9 2.8 2.7 2.3; do
if [ "$v" = "2.9" ]; then
target=main-2.x
else
target=release/$v.x
fi
git checkout origin/$target
git cherry-pick $cherry
git push origin HEAD:refs/heads/backport-$v-${cherry:0:8}
done
git checkout main