From 9273e3cdecd475e94ea172a629b3660df8bd7f1c Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Wed, 22 Dec 2021 11:21:15 +1000 Subject: [PATCH] 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. --- packaging/update-version | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 packaging/update-version diff --git a/packaging/update-version b/packaging/update-version new file mode 100755 index 0000000..c32f1dd --- /dev/null +++ b/packaging/update-version @@ -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