grokkit/release.sh

65 lines
1.8 KiB
Bash
Raw Normal View History

#!/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."