From c179491aed399118453cba8368f48fd0925943e5 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Fri, 20 Mar 2026 10:38:07 +0530 Subject: [PATCH] build: add release script --- package.json | 3 ++- scripts/release.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 scripts/release.sh diff --git a/package.json b/package.json index 3d098ea..9b53ab9 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "scripts": { "build": "bun build src/index.ts src/cli.ts --outdir dist --target bun --format esm", "test": "bun test", - "prepublishOnly": "bun run build" + "prepublishOnly": "bun run build", + "release": "bash ./scripts/release.sh" }, "dependencies": { "@opencode-ai/plugin": "^1.2.27", diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 0000000..24b628b --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -e + +# Prompt for version bump type +read -p "Select version bump (major/minor/patch): " bump +if [[ ! "$bump" =~ ^(major|minor|patch)$ ]]; then + echo "Invalid choice. Must be 'major', 'minor', or 'patch'." + exit 1 +fi + +# Run tests +echo "Running test suite..." +npm test + +# Build the project +echo "Building the project..." +npm run build + +# Bump version +echo "Bumping version ($bump)..." +npm version "$bump" -m "chore(release): %s" + +# Show git status +git status + +# Confirm publishing +read -p "Proceed with npm publish? (y/N): " confirm +if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then + echo "Publish aborted." + exit 0 +fi + +# Publish to npm +npm publish + +# Push git commits and tags +git push && git push --tags + +echo "Release completed successfully."