mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-10 03:30:59 +00:00
Add release script to bump version, tag, and push
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5501ba6fe7
commit
982327da6c
1 changed files with 51 additions and 0 deletions
51
scripts/release.sh
Executable file
51
scripts/release.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CARGO_TOML="$(git rev-parse --show-toplevel)/Cargo.toml"
|
||||
|
||||
current_version=$(grep -m1 '^version = ' "$CARGO_TOML" | sed 's/version = "\(.*\)"/\1/')
|
||||
echo "Current version: $current_version"
|
||||
|
||||
IFS='.' read -r major minor patch <<< "$current_version"
|
||||
|
||||
echo ""
|
||||
echo "Select bump type:"
|
||||
echo " 1) patch ($current_version -> $major.$minor.$((patch + 1)))"
|
||||
echo " 2) minor ($current_version -> $major.$((minor + 1)).0)"
|
||||
echo " 3) major ($current_version -> $((major + 1)).0.0)"
|
||||
echo ""
|
||||
read -rp "Choice [1/2/3]: " choice
|
||||
|
||||
case "$choice" in
|
||||
1) new_version="$major.$minor.$((patch + 1))" ;;
|
||||
2) new_version="$major.$((minor + 1)).0" ;;
|
||||
3) new_version="$((major + 1)).0.0" ;;
|
||||
*) echo "Invalid choice"; exit 1 ;;
|
||||
esac
|
||||
|
||||
tag="v$new_version"
|
||||
|
||||
if git rev-parse "$tag" >/dev/null 2>&1; then
|
||||
echo "Error: tag $tag already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Will bump $current_version -> $new_version and push tag $tag"
|
||||
read -rp "Continue? [y/N]: " confirm
|
||||
if [[ "$confirm" != [yY] ]]; then
|
||||
echo "Aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '' "s/^version = \"$current_version\"/version = \"$new_version\"/" "$CARGO_TOML"
|
||||
echo "Updated $CARGO_TOML"
|
||||
|
||||
git add "$CARGO_TOML"
|
||||
git commit -m "Bump version to $new_version"
|
||||
git tag "$tag"
|
||||
git push origin main "$tag"
|
||||
|
||||
echo ""
|
||||
echo "Released $tag"
|
||||
echo "Watch the build: https://github.com/brynary/arc/actions"
|
||||
Loading…
Add table
Reference in a new issue