Skip to content

Commit c0386bf

Browse files
committed
chore: add release script for version tagging
1 parent 6924378 commit c0386bf

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"docs:dev": "bun run --cwd apps/docs dev",
5959
"docs:build": "bun run --cwd apps/docs build",
6060
"prepublishOnly": "bun run build",
61-
"prepare": "husky"
61+
"prepare": "husky",
62+
"release": "./scripts/release.sh"
6263
},
6364
"devDependencies": {
6465
"@biomejs/biome": "^2.3.10",

scripts/release.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [ $# -eq 0 ]; then
5+
echo "Usage: bun run release <version>"
6+
echo ""
7+
echo "Examples:"
8+
echo " bun run release 0.0.1-beta.1"
9+
echo " bun run release patch"
10+
echo " bun run release minor"
11+
echo " bun run release major"
12+
exit 1
13+
fi
14+
15+
VERSION_ARG="$1"
16+
17+
# Check for uncommitted changes
18+
if ! git diff --quiet || ! git diff --staged --quiet; then
19+
echo "Error: You have uncommitted changes"
20+
exit 1
21+
fi
22+
23+
echo "Bumping version to $VERSION_ARG..."
24+
npm version "$VERSION_ARG" --no-git-tag-version
25+
26+
NEW_VERSION=$(node -p "require('./package.json').version")
27+
TAG="v$NEW_VERSION"
28+
29+
echo "Committing version bump..."
30+
git add package.json
31+
git commit -m "release: $TAG"
32+
33+
echo "Creating tag $TAG..."
34+
git tag "$TAG"
35+
36+
echo "Pushing branch and tag to origin..."
37+
git push && git push origin "$TAG"
38+
39+
echo ""
40+
echo "Done! Released $TAG"
41+
echo "GitHub Actions will now:"
42+
echo " 1. Create a GitHub Release"
43+
echo " 2. Publish to npm"

0 commit comments

Comments
 (0)