Files
weight_tracker/scripts/bump.sh
2026-04-11 15:07:49 +02:00

34 lines
700 B
Bash

#!/bin/sh
set -euo pipefail
VERSION_CLEAN="$(git cliff --bumped-version)"
if [[ ! $VERSION_CLEAN =~ ^[0-9] ]]; then
echo "Error: VERSION_CLEAN does not start with a number"
exit 1
fi
VERSION="v${VERSION_CLEAN}"
sed -i "s/^version = \".*\"/version = \"${VERSION_CLEAN}\"/" Cargo.toml
cargo check
echo Press Y to commit version bump to ${VERSION_CLEAN}
read -r CONFIRM
if [ "${CONFIRM}" != "Y" ]; then
echo Aborting
exit 1
fi
git commit --allow-empty -am "chore: bump version to ${VERSION}"
git tag -am "Version ${VERSION}" "${VERSION}"
echo Press Y to push commit and tag
read -r CONFIRM
if [ "${CONFIRM}" != "Y" ]; then
echo Aborting
exit 1
fi
git push
git push --tags