#!/bin/bash # release.sh — One-command release driver for gostations (modeled on grokkit) # Usage: ./release.sh v2.0.0 # # This will: # - Create the git tag (so downstream CI/release can see it) # - Help generate/update CHANGELOG (via grokkit if available) # - Commit the changes # - Push tag + commit # - Print suggested Gitea release notes body set -euo pipefail VERSION="${1:-}" if [[ -z "$VERSION" || ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)? ]]; then echo "❌ Usage: $0 vX.Y.Z" echo " Example: $0 v2.0.0" exit 1 fi echo "🚀 Starting release process for gostations $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 echo "" echo "This will:" echo " 1. Create git tag $VERSION" echo " 2. (If grokkit available) Run grokkit changelog + commit for CHANGELOG.md" echo " 3. Push the commit + tag" echo " 4. Print ready-to-paste text for the Gitea release page" echo "" read -p "Proceed with release $VERSION? (y/N) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Aborted." exit 1 fi # 1. Create the tag early (CI release workflow triggers on tag) echo "đŸˇī¸ Creating tag $VERSION..." git tag "$VERSION" # 2. Changelog / release prep (best effort using grokkit if present on PATH) if command -v grokkit >/dev/null 2>&1; then echo "📝 Generating/updating CHANGELOG.md via grokkit..." grokkit changelog --version "$VERSION" || echo "âš ī¸ grokkit changelog returned non-zero (continuing)" if [[ -n $(git status --porcelain -- CHANGELOG.md) ]]; then echo "đŸ“Ļ Committing changelog changes via grokkit..." git add CHANGELOG.md grokkit commit || echo "âš ī¸ grokkit commit may need manual follow-up" fi else echo "â„šī¸ grokkit not found on PATH. Skipping automated changelog." echo " You can manually edit CHANGELOG.md before the next steps if desired." echo " Then run: git add CHANGELOG.md && git commit -m 'chore(release): $VERSION'" fi # 3. Push (tag was created earlier; push any new commit + tags) echo "📤 Pushing commit (if any) + tag..." git push || true git push --tags # 4. Print nice release notes for Gitea echo "" echo "✅ Release $VERSION pushed!" echo "" echo "📋 Copy-paste the following into the Gitea release notes body:" echo "------------------------------------------------------------" make -s release-notes VERSION="$VERSION" || cat <