44# - install gh cli and semver-cli (go install github.com/davidrjonas/semver-cli@latest)
55# - create and push "release-X.Y" branch
66# - checkout this branch locally
7- # - run this script from repo root: ./hack/create-release-pr.sh
7+ # - run this script from repo root: ./hack/create-release-pr.sh [REMOTE]
88# - merge the PR
99# It will trigger the release workflow that would create release draft on github
1010
11- RELEASE_BRANCH=" $( git rev-parse --abbrev-ref HEAD || true) "
1211set -eux
1312set -o pipefail
1413
14+
15+ CURRENT_BRANCH=" $( git branch --show-current) "
16+
17+ if [[ ! " $CURRENT_BRANCH " == release-* ]]; then
18+ echo " !! Please checkout branch 'release-X.Y' (currently in branch: '${CURRENT_BRANCH} ')" >&2
19+ exit 1
20+ fi
21+
22+ RELEASE_BRANCH=" ${CURRENT_BRANCH} "
23+
1524# ## look for latest on-branch tag
1625PREVIOUS_TAG=$( git describe --tags --abbrev=0 --match " *${RELEASE_BRANCH## release-} *" 2> /dev/null || true)
1726
@@ -26,11 +35,14 @@ echo $NEW_VERSION > VERSION
2635IMAGE_TAG=" v${NEW_VERSION} "
2736make manifests
2837
38+ REMOTE=${1:- origin}
39+ REMOTE_URL=$( git remote get-url ${REMOTE} )
40+
2941git checkout -b " feat/new-version-${NEW_VERSION} "
3042git commit -m " Release ${NEW_VERSION} " VERSION manifests/
31- git push --set-upstream origin " feat/new-version-${NEW_VERSION} "
32- gh label --repo $( git remote get-url origin ) create --force release
33- gh pr --repo $( git remote get-url origin ) \
43+ git push --set-upstream ${REMOTE} " feat/new-version-${NEW_VERSION} "
44+ gh label --repo ${REMOTE_URL} create --force release
45+ gh pr --repo ${REMOTE_URL} \
3446 create \
3547 --base ${RELEASE_BRANCH} \
3648 --title " Release ${NEW_VERSION} " \
0 commit comments