diff --git a/packaging/update-version b/packaging/update-version index 7c39c13..6430265 100755 --- a/packaging/update-version +++ b/packaging/update-version @@ -4,9 +4,12 @@ set -e -# Script only runs at the codebase root. +# Only run at the codebase root. [ $(basename $PWD) == "eris" ] [ -e README.md ] +# Don't run with uncommited or staged changes. +git diff --exit-code +git diff --cached --exit-code NEW_VERSION=$(date "+v%Y.%m.%d") @@ -15,6 +18,8 @@ if [ $NEW_VERSION == $CURRENT_VERSION ]; then git tag --delete $CURRENT_VERSION else git grep -l $CURRENT_VERSION | xargs sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g" + git diff git commit --all --message="Update version from $CURRENT_VERSION to $NEW_VERSION." fi git tag $NEW_VERSION +git log --max-count=1