ty/scripts/release.sh
Zanie Blue 5f9803b4fa
Split the documentation out of the top-level README (#331)
Moves most of the documentation into a dedicated `docs/README` to make
it easier to reach important content in the top-level readme like
"getting involved".

There are some minor changes to the heading levels here and link
changes, but otherwise the content is the same. Don't go deep on the
getting started section, that's changing in #329
2025-05-12 13:45:02 -05:00

56 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env sh
#
# Prepare a release.
#
# Usage
#
# ./scripts/release.sh [rooster-args ...]
#
set -eu
echo "Checking Ruff submodule status..."
if git -C ruff diff --quiet; then
echo "Ruff submodule is clean; continuing..."
else
echo "Ruff submodule has uncommitted changes; aborting!"
exit 1
fi
ruff_head=$(git -C ruff rev-parse --abbrev-ref HEAD)
case "${ruff_head}" in
"HEAD")
echo "Ruff submodule has detached HEAD; switching to main..."
git -C ruff checkout main > /dev/null 2>&1
;;
"main")
echo "Ruff submodule is on main branch; continuing..."
;;
*)
echo "Ruff submodule is on branch ${ruff_head} but must be on main; aborting!"
exit 1
;;
esac
echo "Updating Ruff to the latest commit..."
git -C ruff pull origin main
git add ruff
script_root="$(realpath "$(dirname "$0")")"
project_root="$(dirname "$script_root")"
echo "Running rooster..."
cd "$project_root"
# Generate the changelog and bump versions
uv run --only-group release \
rooster release "$@"
echo "Updating lockfile..."
uv lock
echo "Copying reference documentation from Ruff..."
cp ruff/crates/ty/docs/cli.md ./docs/reference/
cp ruff/crates/ty/docs/configuration.md ./docs/reference/
cp ./ruff/crates/ty/docs/rules.md ./docs/reference/
git add ./docs/reference