Skip to content

Commit

Permalink
scripts/release.sh: check that git repo is clean and that exactly two…
Browse files Browse the repository at this point in the history
… changes were made when bumping version number before proceeding
  • Loading branch information
marcuswestin committed Jun 20, 2017
1 parent ceda934 commit bb256aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
set -e


cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # scripts/
cd ../ # store.js project root

Expand All @@ -17,6 +16,11 @@ if [ "$GIT_BRANCH" != "master" ]; then
exit -1
fi

if [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]]; then
echo "git repo is dirty. Commit all changes before using release.sh"
exit -1
fi

echo
echo "> Bump package.json version:"
echo
Expand All @@ -33,6 +37,11 @@ sed -E s/"version\: '[0-9]+\.[0-9]+\.[0-9]+'"/"version\: '$VERSION'"/ src/store-
mv /tmp/store-engine.js src/store-engine.js
cat src/store-engine.js | grep $VERSION -C 1

if [[ ! `git diff --stat` =~ "2 files changed, 2 insertions, 2 deletions" ]]; then
echo "WARNING! Expected exactly 2 changes in 2 files after replacing version number. Bailing! (check git status and git diff)"
exit -1
fi

echo
while true; do
read -p "> Ready to build, commit, tag and release v$VERSION? (y/n): " yn
Expand Down

0 comments on commit bb256aa

Please sign in to comment.