File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " mux" ,
3- "version" : " 0.8.3 " ,
3+ "version" : " 0.8.4 " ,
44 "description" : " mux - coder multiplexer" ,
55 "author" : " Coder" ,
66 "main" : " dist/cli/index.js" ,
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # Bump version in package.json, commit, and create a git tag.
5+ # Usage: ./scripts/bump_tag.sh [--minor]
6+ # --minor Bump minor version (0.8.x -> 0.9.0), otherwise bumps patch (0.8.3 -> 0.8.4)
7+
8+ MINOR=false
9+ if [[ " ${1:- } " == " --minor" ]]; then
10+ MINOR=true
11+ fi
12+
13+ # Get current version from package.json
14+ CURRENT_VERSION=$( jq -r ' .version' package.json)
15+ if [[ -z " $CURRENT_VERSION " || " $CURRENT_VERSION " == " null" ]]; then
16+ echo " Error: Could not read version from package.json" >&2
17+ exit 1
18+ fi
19+
20+ # Parse semver components
21+ IFS=' .' read -r MAJOR MINOR_V PATCH <<< " $CURRENT_VERSION"
22+
23+ # Calculate new version
24+ if [[ " $MINOR " == " true" ]]; then
25+ NEW_VERSION=" ${MAJOR} .$(( MINOR_V + 1 )) .0"
26+ else
27+ NEW_VERSION=" ${MAJOR} .${MINOR_V} .$(( PATCH + 1 )) "
28+ fi
29+
30+ echo " Bumping version: $CURRENT_VERSION -> $NEW_VERSION "
31+
32+ # Update package.json
33+ jq --arg v " $NEW_VERSION " ' .version = $v' package.json > package.json.tmp
34+ mv package.json.tmp package.json
35+
36+ # Commit and tag
37+ git add package.json
38+ git commit -m " release: v${NEW_VERSION} "
39+ git tag " v${NEW_VERSION} "
40+
41+ echo " Created tag v${NEW_VERSION} "
42+ echo " Run 'git push && git push --tags' to publish"
You can’t perform that action at this time.
0 commit comments