File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 88 "lint" : " eslint . --cache" ,
99 "lint:all" : " eslint ." ,
1010 "lint:fix" : " eslint . --fix --cache" ,
11- "lint:fix-all" : " eslint . --fix"
11+ "lint:fix-all" : " eslint . --fix" ,
12+ "bump" : " bash utils/bump.sh"
1213 }
1314}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Init UI colors
4+ nc=" \033[0m" # no color
5+ br=" \033[1;91m" # bright red for old versions
6+ by=" \033[1;33m" # bright yellow
7+ bg=" \033[1;92m" # bright green for success message and new versions
8+ bw=" \033[1;97m" # bright white
9+
10+ # Init manifest path
11+ MANIFEST=" chromium/extension/manifest.json"
12+
13+ # Bump version
14+ echo -e " ${by} \nBumping version in ${MANIFEST} ...${nc} \n"
15+ TODAY=$( date +' %Y.%-m.%-d' ) # YYYY.M.D format
16+ NEW_VERSIONS=() # for dynamic commit msg
17+ OLD_VER=$( sed -n ' s/.*"version": *"\([0-9.]*\)".*/\1/p' " $MANIFEST " )
18+ if [[ $OLD_VER == " $TODAY " ]] # exact match for $TODAY
19+ then # bump to $TODAY.1
20+ NEW_VER=" $TODAY .1"
21+ elif [[ $OLD_VER == " $TODAY ." * ]] # partial match for $TODAY
22+ then # bump to $TODAY.n+1
23+ LAST_NUMBER=$( echo " $OLD_VER " | awk -F ' .' ' {print $NF}' )
24+ NEW_VER=" $TODAY .$(( LAST_NUMBER + 1 )) "
25+ else # no match for $TODAY
26+ # bump to $TODAY
27+ NEW_VER=" $TODAY "
28+ fi
29+ sed -i " s/\" version\" : \" $OLD_VER \" /\" version\" : \" $NEW_VER \" /" " $MANIFEST "
30+ echo -e " ${bw} v${OLD_VER}${nc} → ${bg} v${NEW_VER}${nc} "
31+
32+ # Commit bumps
33+ echo -e " ${by} \nCommitting $( [[ $MULTI_BUMP == true ]] && echo bumps || echo bump) to Git...\n${nc} "
34+ git add ./** /manifest.json
35+ git commit -n -m " Bumped \` version\` to $NEW_VER "
36+ git push
37+
38+ # Print final summary
39+ echo -e " \n${bg} Success! ${MANIFEST} updated/committed/pushed to GitHub${nc} "
You can’t perform that action at this time.
0 commit comments