File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # bump-version.sh — Standardised version bumping for Allow2 Node SDK
3+ # Usage: ./scripts/bump-version.sh [prerelease|patch|minor|major] [--preid alpha|beta|rc]
4+ #
5+ # Examples:
6+ # ./scripts/bump-version.sh prerelease --preid alpha # 2.0.0-alpha.6 → 2.0.0-alpha.7
7+ # ./scripts/bump-version.sh prerelease --preid beta # 2.0.0-alpha.7 → 2.0.0-beta.0
8+ # ./scripts/bump-version.sh patch # 2.0.0-alpha.7 → 2.0.1
9+ # ./scripts/bump-version.sh minor # 2.0.1 → 2.1.0
10+ # ./scripts/bump-version.sh major # 2.1.0 → 3.0.0
11+ set -euo pipefail
12+ cd " $( dirname " $0 " ) /.."
13+
14+ BUMP=" ${1:- prerelease} "
15+ PREID=" "
16+ if [[ " ${2:- } " == " --preid" ]]; then PREID=" ${3:- alpha} " ; fi
17+
18+ OLD=$( node -p " require('./package.json').version" )
19+
20+ case " $BUMP " in
21+ prerelease)
22+ if [[ -n " $PREID " ]]; then
23+ npm version prerelease --preid=" $PREID " --no-git-tag-version
24+ else
25+ npm version prerelease --no-git-tag-version
26+ fi
27+ ;;
28+ patch|minor|major)
29+ npm version " $BUMP " --no-git-tag-version
30+ ;;
31+ * )
32+ echo " Usage: $0 [prerelease|patch|minor|major] [--preid alpha|beta|rc]" >&2
33+ exit 1
34+ ;;
35+ esac
36+
37+ NEW=$( node -p " require('./package.json').version" )
38+ echo " $OLD → $NEW "
39+
40+ git add package.json
41+ git commit -m " v$NEW "
42+ git tag " v$NEW "
43+ echo " Tagged v$NEW — push with: git push origin main --tags"
You can’t perform that action at this time.
0 commit comments