2021-12-22 11:21:15 +10:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
2021-12-22 17:49:31 +10:00
|
|
|
# Only run at the codebase root.
|
2022-01-03 16:14:12 +10:00
|
|
|
[ -e .git ]
|
2021-12-22 17:49:31 +10:00
|
|
|
# Don't run with uncommited or staged changes.
|
|
|
|
|
git diff --exit-code
|
|
|
|
|
git diff --cached --exit-code
|
2021-12-22 11:21:15 +10:00
|
|
|
|
|
|
|
|
|
2021-12-22 11:31:54 +10:00
|
|
|
NEW_VERSION=$(date "+v%Y.%m.%d")
|
2021-12-22 11:21:15 +10:00
|
|
|
CURRENT_VERSION=$(git describe --tags --abbrev=0)
|
|
|
|
|
if [ $NEW_VERSION == $CURRENT_VERSION ]; then
|
|
|
|
|
git tag --delete $CURRENT_VERSION
|
2022-02-23 19:44:59 +10:00
|
|
|
git push --delete origin $CURRENT_VERSION
|
2024-12-28 18:46:47 +10:00
|
|
|
else
|
|
|
|
|
git grep --no-color -l $CURRENT_VERSION | xargs sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g"
|
2025-06-03 16:57:44 +10:00
|
|
|
uv lock
|
2024-12-28 18:46:47 +10:00
|
|
|
git commit --all --message="Update version to $NEW_VERSION"
|
2021-12-22 11:21:15 +10:00
|
|
|
fi
|
|
|
|
|
git tag $NEW_VERSION
|
2022-02-23 19:44:59 +10:00
|
|
|
git push
|
|
|
|
|
git push --tags
|
2022-02-25 23:40:31 +10:00
|
|
|
echo "Done."
|