Files
doos/scripts/release.sh
T

36 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Bump VERSION, build, run the e2e suite, commit everything, tag.
# Usage: scripts/release.sh patch|minor|major "commit subject"
# Refuses to run when the build or tests fail. Does not push.
set -euo pipefail
cd "$(dirname "$0")/.."
kind=${1:?usage: release.sh patch|minor|major "subject"}
subject=${2:?usage: release.sh patch|minor|major "subject"}
IFS=. read -r maj min pat < VERSION
case "$kind" in
patch) pat=$((pat+1)) ;;
minor) min=$((min+1)); pat=0 ;;
major) maj=$((maj+1)); min=0; pat=0 ;;
*) echo "kind must be patch, minor or major" >&2; exit 2 ;;
esac
new="$maj.$min.$pat"
if git rev-parse "v$new" >/dev/null 2>&1; then echo "tag v$new already exists" >&2; exit 1; fi
if grep -rl $'\xe2\x80\x94' --exclude-dir=build --exclude-dir=.git . | grep -q .; then
echo "em dash found, remove it first" >&2; exit 1
fi
echo "$new" > VERSION
cmake -S . -B build >/dev/null
cmake --build build
tests/run.sh
git add -A
git commit -m "$subject
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>"
git tag -a "v$new" -m "doos $new"
echo "released v$new"