File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " mux" ,
3- "version" : " 0.8.5 " ,
3+ "version" : " 0.8.6 " ,
44 "description" : " mux - coder multiplexer" ,
55 "author" : " Coder" ,
66 "main" : " dist/cli/index.js" ,
Original file line number Diff line number Diff line change 2929
3030echo " Bumping version: $CURRENT_VERSION -> $NEW_VERSION "
3131
32+ # Rollback function to restore original state on failure
33+ rollback () {
34+ echo " Error: Rolling back changes..." >&2
35+ jq --arg v " $CURRENT_VERSION " ' .version = $v' package.json > package.json.tmp
36+ mv package.json.tmp package.json
37+ git reset HEAD -- package.json 2> /dev/null || true
38+ exit 1
39+ }
40+
3241# Update package.json
3342jq --arg v " $NEW_VERSION " ' .version = $v' package.json > package.json.tmp
3443mv package.json.tmp package.json
3544
36- # Commit and tag
37- git add package.json
38- git commit -m " release: v${NEW_VERSION} "
39- git tag " v${NEW_VERSION} "
45+ # Commit and tag (rollback on failure)
46+ git add package.json || rollback
47+ git commit -m " release: v${NEW_VERSION} " || rollback
48+ git tag " v${NEW_VERSION} " || rollback
4049
4150echo " Created tag v${NEW_VERSION} "
4251echo " Run 'git push && git push --tags' to publish"
You can’t perform that action at this time.
0 commit comments