diff --git a/release.sh b/release.sh index 6a999d9..7454db6 100755 --- a/release.sh +++ b/release.sh @@ -2,6 +2,13 @@ PACKAGE_VERSION=`node -p -e "require('./package.json').version"` +HAS_CHANGES=`git diff | wc -l` + +if [ $HAS_CHANGES -ne 0 ]; then + echo "Working directory not clean, please commit all pending files" + exit 1 +fi + if [[ -z $1 ]]; then echo "Enter new version (currently $PACKAGE_VERSION): " read VERSION @@ -9,7 +16,7 @@ else VERSION=$1 fi -if [[ $VERSION == $PACKAGE_VERSION ]]; then +if [ $VERSION = $PACKAGE_VERSION ]; then echo "No version change, exiting" exit 1 fi @@ -23,18 +30,21 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then echo "* * * * * * * Releasing $VERSION * * * * * * *" echo - # update package.json - npm version $VERSION --message "[release] $VERSION" + # update package.json version to be used in the build + npm version $VERSION --no-git-tag-version # build npm run build + # generate the git tag + git tag v$VERSION + # commit git add -A git commit -m "[build] $VERSION" # publish - # git push origin refs/tags/v$VERSION - # git push - # npm publish + git push origin refs/tags/v$VERSION + git push + npm publish fi