Skip to content

Commit 21f56f5

Browse files
author
jacobawenger
committed
Improvements to release.sh script
1 parent 9a06796 commit 21f56f5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

release.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,21 @@ if [[ $VERSION != $NPM_VERSION ]]; then
2121
exit 1
2222
fi
2323

24-
# Create a new git tag if they have not already done so
24+
# Ensure the checked out branch is master
25+
CHECKED_OUT_BRANCH="$(git branch | grep "*" | awk -F ' ' '{print $2}')"
26+
if [[ $CHECKED_OUT_BRANCH != "master" ]]; then
27+
echo "Error: Your firebase-tools repo is not on the master branch."
28+
exit 1
29+
fi
30+
31+
# Pull any changes to the firebase-tools repo
32+
git pull origin master
33+
if [[ $? -ne 0 ]]; then
34+
echo "Error: Failed to do git pull from firebase-tools repo."
35+
exit 1
36+
fi
37+
38+
# Create a git tag for the new version
2539
LAST_GIT_TAG="$(git tag --list | tail -1 | awk -F 'v' '{print $2}')"
2640
if [[ $VERSION != $LAST_GIT_TAG ]]; then
2741
git tag v$VERSION
@@ -30,8 +44,8 @@ if [[ $VERSION != $LAST_GIT_TAG ]]; then
3044
echo "*** Last commit tagged as v${VERSION} ***"
3145
echo
3246
else
33-
echo "*** Git tag v${VERSION} already created ***"
34-
echo
47+
echo "Error: git tag v${VERSION} already exists. Make sure you are not releasing an already-released version."
48+
exit 1
3549
fi
3650

3751
# Publish the new version to npm

0 commit comments

Comments
 (0)