Commit 5ea93af 1 parent 4dce96a commit 5ea93af Copy full SHA for 5ea93af
File tree 1 file changed +20
-2
lines changed
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- # Running `npm version` will run through the other version lifecycle scripts
4
- npm version ${1-patch} ;
3
+ # This script will determine the type of release based on the git branch.
4
+ # When the default branch is used, it will be a `patch` that's published to npm
5
+ # under the `latest` dist-tag. Any other branch will be a `prelease` that's
6
+ # published to npm under the `alpha-$SHA` dist-tag.
7
+ bump=' patch'
8
+ tag=' latest'
9
+
10
+ current_branch=$( git rev-parse --abbrev-ref HEAD)
11
+ default_branch=$( git remote show origin | sed -n ' /HEAD branch/s/.*: //p' )
12
+ current_sha=$( git rev-parse --short HEAD)
13
+
14
+ if [ " $current_branch " != " $default_branch " ]; then
15
+ bump=' prerelease'
16
+ tag=" alpha-$current_sha "
17
+ export tag
18
+ npm --no-git-tag-version version $bump --preid=$tag
19
+ else
20
+ export tag
21
+ npm version $bump
22
+ fi
You can’t perform that action at this time.
0 commit comments