eris/packaging/push-new-version
Andrew Hamilton d8aef62647 packaging: Quieter push-new-version
- Don't really need to show diff or logs for review.
2022-02-25 23:40:31 +10:00

26 lines
596 B
Bash
Executable file

#!/bin/bash
set -e
# Only run at the codebase root.
[ -e .git ]
# Don't run with uncommited or staged changes.
git diff --exit-code
git diff --cached --exit-code
NEW_VERSION=$(date "+v%Y.%m.%d")
CURRENT_VERSION=$(git describe --tags --abbrev=0)
if [ $NEW_VERSION == $CURRENT_VERSION ]; then
git tag --delete $CURRENT_VERSION
git push --delete origin $CURRENT_VERSION
else
git grep -l $CURRENT_VERSION | xargs sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g"
git commit --all --message="Update version to $NEW_VERSION"
fi
git tag $NEW_VERSION
git push
git push --tags
echo "Done."