feat(release): add release.sh script
All checks were successful
CI / Test (push) Successful in 34s
CI / Lint (push) Successful in 26s
CI / Build (push) Successful in 21s

Introduce a bash script to automate the Grokkit release process. It handles version validation, git tag creation, changelog generation via grokkit changelog, committing changes via grokkit commit, and pushing to the repository. Includes safety checks and user confirmations.
This commit is contained in:
Greg Gauthier 2026-03-03 22:21:29 +00:00
parent 6005a2192a
commit 162504fa88

65
release.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
# release.sh — One-command release driver for Grokkit
# Usage: ./release.sh v0.2.3
set -euo pipefail
VERSION="${1:-}"
if [[ -z "$VERSION" || ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "❌ Usage: $0 vX.Y.Z"
echo " Example: $0 v0.2.3"
exit 1
fi
echo "🚀 Starting release process for $VERSION..."
# Safety check: clean working tree
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Working tree is dirty. Commit or stash changes first."
exit 1
fi
# Final human confirmation before anything touches git
echo ""
echo "This will:"
echo " 1. Create git tag $VERSION"
echo " 2. Run grokkit changelog (with preview + your confirmation)"
echo " 3. Stage CHANGELOG.md and run grokkit commit (AI message + confirmation)"
echo " 4. Push commit + tag"
echo ""
read -p "Proceed with release $VERSION? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 1
fi
# 1. Tag first (so changelog can see it as LatestTag)
echo "🏷️ Creating tag $VERSION..."
git tag "$VERSION"
# 2. Generate changelog (interactive preview + confirm inside the command)
echo "📝 Generating CHANGELOG.md section..."
grokkit changelog --version "$VERSION"
# 3. Commit with Grok (uses the exact same safety flow you already love)
echo "📦 Staging and committing changelog..."
git add CHANGELOG.md
grokkit commit
# 4. Push everything
echo "📤 Pushing commit + tag..."
git push
git push --tags
# 5. Show the exact notes ready for Gitea release page
echo ""
echo "✅ Release $VERSION complete!"
echo ""
echo "📋 Copy-paste this into the Gitea release notes:"
echo "------------------------------------------------"
grokkit changelog --stdout --version "$VERSION"
echo "------------------------------------------------"
echo ""
echo "🎉 Done! Go create the release on Gitea now."