Add script to update version of eris.

- Globally replaces old version for new throughout the codebase,
  commits the change, then creates a tag for the new version at the head.
- This is instead of magic code within setup.py that tries to pull
  the version from git at runtime. Also git isn't always available.
This commit is contained in:
Andrew Hamilton 2021-12-22 11:21:15 +10:00
parent 851a40dd1a
commit 9273e3cdec

20
packaging/update-version Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
set -e
# Script only runs at the codebase root.
[ $(basename $PWD) == "eris" ]
[ -e README.md ]
NEW_VERSION=$(date "+%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