eris/packaging/update-version
Andrew Hamilton 486d7b3f27 Prefix version strings with 'v'.
- Makes it safer to globally replace the version string.
- Also emphasises its a version, not just a date.
2021-12-22 11:31:54 +10:00

20 lines
481 B
Bash
Executable file

#!/bin/bash
set -e
# Script only runs at the codebase root.
[ $(basename $PWD) == "eris" ]
[ -e README.md ]
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
else
git grep -l $CURRENT_VERSION | xargs sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g"
git commit --all --message="Update version from $CURRENT_VERSION to $NEW_VERSION."
fi
git tag $NEW_VERSION