From 162504fa881c24a65529d548c42bad5817bbd413 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Tue, 3 Mar 2026 22:21:29 +0000 Subject: [PATCH] feat(release): add release.sh script 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. --- release.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..2ff0069 --- /dev/null +++ b/release.sh @@ -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." \ No newline at end of file