diff --git a/scripts/publish.sh b/scripts/publish.sh index 487855e3..584d9f10 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -3,23 +3,27 @@ set -e VERSION='invalid' +COMMIT="0" Help() { # Display Help echo "Add description of the script functions here." echo - echo "Syntax: publish.sh [-v|h]" + echo "Syntax: publish.sh [-v|c|h]" echo "options:" echo "v Version of package to release" + echo "c Commit and tag" echo "h Print this Help" echo } -while getopts ":hv:" option; do +while getopts ":hv:c:" option; do case $option in - v) # Enter a name + v) VERSION=$OPTARG;; + c) + COMMIT=$OPTARG;; h) # display Help Help exit;; @@ -39,6 +43,10 @@ npm version ${VERSION} --no-commit-hooks --no-git-tag-version --preid beta popd -# git commit -am 'chore(version): Bump version' +if [ "$COMMIT" = "1" ]; then + echo "Commiting and tagging" -# git tag -a "${VERSION}" -m "Version ${VERSION}" + git commit -am 'chore(version): Bump version' + + git tag -a "${VERSION}" -m "Version ${VERSION}" +fi