Make update-version script more usable.
- Fail if uncommited or staged changes are in the working directory. - Show the version changes as a diff. - On success show the commit log message.
This commit is contained in:
parent
292f58e309
commit
b522577fa3
1 changed files with 6 additions and 1 deletions
|
|
@ -4,9 +4,12 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
# Script only runs at the codebase root.
|
# Only run at the codebase root.
|
||||||
[ $(basename $PWD) == "eris" ]
|
[ $(basename $PWD) == "eris" ]
|
||||||
[ -e README.md ]
|
[ -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")
|
NEW_VERSION=$(date "+v%Y.%m.%d")
|
||||||
|
|
@ -15,6 +18,8 @@ if [ $NEW_VERSION == $CURRENT_VERSION ]; then
|
||||||
git tag --delete $CURRENT_VERSION
|
git tag --delete $CURRENT_VERSION
|
||||||
else
|
else
|
||||||
git grep -l $CURRENT_VERSION | xargs sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g"
|
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."
|
git commit --all --message="Update version from $CURRENT_VERSION to $NEW_VERSION."
|
||||||
fi
|
fi
|
||||||
git tag $NEW_VERSION
|
git tag $NEW_VERSION
|
||||||
|
git log --max-count=1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue