@@ -4,13 +4,16 @@ export NODE_PATH=$NODE_PATH:./node_modules
44
55# Temp versions
66OLD_VERSION=" XXX"
7+ NEW_VERSION=" $2 "
78VERSION=" XXX"
89
910
10- # Major, minor, or patch release
11+ # Release types
12+ custom_release=false
1113major_release=false
1214minor_release=false
1315patch_release=false
16+ pre_release=false
1417
1518reset_tags () {
1619 # Wipe tags
@@ -117,6 +120,16 @@ increment_version() {
117120 echo " Bumping patch version..."
118121 echo " ----------------------------------------------------------------------"
119122 npm --no-git-tag-version version patch
123+ elif $pre_release ; then
124+ echo " ----------------------------------------------------------------------"
125+ echo " Bumping prerelease version..."
126+ echo " ----------------------------------------------------------------------"
127+ npm --no-git-tag-version --preid=beta version prerelease
128+ elif $custom_release ; then
129+ echo " ----------------------------------------------------------------------"
130+ echo " Bumping to custom version..."
131+ echo " ----------------------------------------------------------------------"
132+ npm --no-git-tag-version version $NEW_VERSION
120133 fi
121134
122135 # The current version being built
@@ -201,20 +214,15 @@ push_new_release() {
201214 exit 1
202215 fi
203216
204- # Get latest commited code and tags
217+ # Get latest committed code and tags
205218 if $patch_release ; then
206219 echo " ----------------------------------------------------------------------"
207220 echo " Starting patch release - skipping reset to master"
208221 echo " IMPORTANT - your branch should be in the state you want for the patch"
209222 echo " ----------------------------------------------------------------------"
210- elif $minor_release ; then
211- echo " ----------------------------------------------------------------------"
212- echo " Starting minor release - reset to upstream master"
213- echo " ----------------------------------------------------------------------"
214- reset_to_master || return 1
215223 else
216224 echo " ----------------------------------------------------------------------"
217- echo " Starting major release - reset to upstream master"
225+ echo " Starting release - reset to upstream master"
218226 echo " ----------------------------------------------------------------------"
219227 reset_to_master || return 1
220228 fi
@@ -273,19 +281,28 @@ push_new_release() {
273281 echo " ----------------------------------------------------------------------"
274282 ./node_modules/.bin/conventional-github-releaser
275283
284+ # Push NPM release
285+ echo " ----------------------------------------------------------------------"
286+ echo " Pushing new NPM release"
287+ echo " ----------------------------------------------------------------------"
288+ ./scripts/publish.sh
289+
276290 return 0
277291}
278292
279-
280293# Check if we are doing major, minor, or patch release
281- while getopts " mnp " opt; do
294+ while getopts " cmnpx " opt; do
282295 case " $opt " in
296+ c )
297+ custom_release=true ;;
283298 m )
284299 major_release=true ;;
285300 n )
286301 minor_release=true ;;
287302 p )
288303 patch_release=true ;;
304+ x )
305+ pre_release=true ;;
289306 esac
290307done
291308
@@ -311,7 +328,7 @@ if ! push_new_release; then
311328 echo " ----------------------------------------------------------------------"
312329 else
313330 echo " ----------------------------------------------------------------------"
314- echo " Workspace succesfully cleaned!"
331+ echo " Workspace successfully cleaned!"
315332 echo " ----------------------------------------------------------------------"
316333 fi ;
317334 exit 1
0 commit comments