2
2
git clean -fx dist/*
3
3
git diff-index HEAD --stat --exit-code || exit $?
4
4
5
- INITIAL_REV =$( git rev-parse --abbrev-ref HEAD)
5
+ INITIAL_BRANCH =$( git rev-parse --abbrev-ref HEAD)
6
6
7
7
echo ' checking out the "unstable" branch'
8
8
git checkout unstable || exit $?
9
9
10
- git merge --no-ff --no-edit $INITIAL_REV || exit $?
10
+ git merge --no-ff --no-edit $INITIAL_BRANCH || exit $?
11
11
12
12
# preversion tests must pass
13
13
npm run preversion || exit $?
@@ -16,22 +16,28 @@ npm run preversion || exit $?
16
16
NEW_VERSION=$( node build/bump prerelease)
17
17
NEW_TAG=$( echo " v$NEW_VERSION " | sed ' s/[+].*//' )
18
18
19
- npm run build &&
20
- git commit -m " v$NEW_VERSION " -- package.json dist || exit $?
19
+ # if the version tag already exists, reset head to previous commit and exit
20
+ if [ git cat-file -e $NEW_TAG ]; then
21
+ exit 1
22
+ fi
21
23
22
- # add new version tag
23
- if git tag $NEW_TAG ; then
24
- # push branch and tags to git origin and publish to npm
25
- git tag --force next &&
26
- git push &&
27
- git push origin $NEW_TAG next &&
28
- npm publish --tag next
29
- else
30
- # if the version tag already exists, reset head to previous commit and exit
31
- err=$?
32
- git reset HEAD@{1}
33
- exit $err
24
+ npm run build || exit $?
25
+
26
+ if [ ! git diff --quiet next ]; then
27
+ echo files of this build and the existing " next" tag are identical
28
+ exit 1
34
29
fi
35
30
31
+
32
+ git commit -m " v$NEW_VERSION " -- package.json dist || exit $?
33
+
34
+ # add new version tag
35
+ git tag $NEW_TAG
36
+ # push branch and tags to git origin and publish to npm
37
+ git tag --force next &&
38
+ git push &&
39
+ git push origin $NEW_TAG next &&
40
+ npm publish --tag next
41
+
36
42
# leave the "unstable" branch
37
- git checkout $INITIAI_REV
43
+ git checkout $INITIAL_BRANCH
0 commit comments