diff --git a/scripts/release.sh b/scripts/release.sh index 520d1966..769b5f47 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -28,6 +28,36 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" CLI_DIR="$REPO_ROOT/cli" +# ── Helper: create GitHub Release ──────────────────────────────────────────── +create_github_release() { + local version="$1" + local is_dry_run="$2" + local release_notes="$REPO_ROOT/releases/v${version}.md" + + if [ "$is_dry_run" = true ]; then + echo " [dry-run] gh release create v$version" + return + fi + + if ! command -v gh &>/dev/null; then + echo " ⚠ gh CLI not found — skipping GitHub Release" + return + fi + + local gh_args=(gh release create "v$version" --title "v$version") + if [ -f "$release_notes" ]; then + gh_args+=(--notes-file "$release_notes") + else + gh_args+=(--generate-notes) + fi + + if "${gh_args[@]}"; then + echo " ✓ Created GitHub Release v$version" + else + echo " ⚠ GitHub Release creation failed (non-fatal)" + fi +} + # ── Parse args ──────────────────────────────────────────────────────────────── dry_run=false @@ -141,11 +171,14 @@ console.log(names.join('\n')); echo " ✓ Committed and tagged v$NEW_VERSION" fi + create_github_release "$NEW_VERSION" "$dry_run" + echo "" if [ "$dry_run" = true ]; then echo "Dry run complete for promote v$NEW_VERSION." echo " - Would promote all packages to @latest" echo " - Would commit and tag v$NEW_VERSION" + echo " - Would create GitHub Release" else echo "Promoted all packages to @latest at v$NEW_VERSION" echo "" @@ -346,6 +379,10 @@ if [ "$canary" = false ]; then echo " ✓ Committed and tagged v$NEW_VERSION" fi +if [ "$canary" = false ]; then + create_github_release "$NEW_VERSION" "$dry_run" +fi + # ── Done ────────────────────────────────────────────────────────────────────── echo "" @@ -371,6 +408,7 @@ elif [ "$dry_run" = true ]; then echo " - Versions bumped, built, and previewed" echo " - Dev package.json restored" echo " - Commit and tag created (locally)" + echo " - Would create GitHub Release" echo "" echo "To actually publish, run:" echo " ./scripts/release.sh $bump_type" @@ -379,4 +417,6 @@ else echo "" echo "To push:" echo " git push && git push origin v$NEW_VERSION" + echo "" + echo "GitHub Release: https://github.com/cryppadotta/paperclip/releases/tag/v$NEW_VERSION" fi