Skip to content

Commit e02b176

Browse files
authored
chore(release): make sure release branch exist on remote before proceeding (#813)
1 parent 2c31e6a commit e02b176

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

hack/create-release-pr.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ fi
2121

2222
RELEASE_BRANCH="${CURRENT_BRANCH}"
2323

24+
REMOTE=${1:-origin}
25+
REMOTE_URL=$(git remote get-url ${REMOTE})
26+
27+
if [[ ! $(git ls-remote --exit-code ${REMOTE_URL} ${RELEASE_BRANCH}) ]]; then
28+
echo "!! Please make sure '${RELEASE_BRANCH}' exists in remote '${REMOTE}'" >&2
29+
exit 1
30+
fi
31+
2432
### look for latest on-branch tag
2533
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "*${RELEASE_BRANCH##release-}*" 2>/dev/null || true)
2634

@@ -31,13 +39,9 @@ else
3139
fi
3240

3341
echo $NEW_VERSION > VERSION
34-
3542
IMAGE_TAG="v${NEW_VERSION}"
3643
make manifests
3744

38-
REMOTE=${1:-origin}
39-
REMOTE_URL=$(git remote get-url ${REMOTE})
40-
4145
git checkout -b "feat/new-version-${NEW_VERSION}"
4246
git commit -m "Release ${NEW_VERSION}" VERSION manifests/
4347
git push --set-upstream ${REMOTE} "feat/new-version-${NEW_VERSION}"

0 commit comments

Comments
 (0)