forked from javisperez/vuedals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·50 lines (37 loc) · 916 Bytes
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/bash
PACKAGE_VERSION=`node -p -e "require('./package.json').version"`
HAS_CHANGES=`git diff | wc -l`
if [ $HAS_CHANGES -ne 0 ]; then
echo "Working directory not clean, please commit all pending files"
exit 1
fi
if [[ -z $1 ]]; then
echo "Enter new version (currently $PACKAGE_VERSION): "
read VERSION
else
VERSION=$1
fi
if [ $VERSION = $PACKAGE_VERSION ]; then
echo "No version change, exiting"
exit 1
fi
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
echo "* * * * * * * Releasing $VERSION * * * * * * *"
echo
# update package.json version to be used in the build
npm version $VERSION --no-git-tag-version
# build
npm run build
# generate the git tag
git tag v$VERSION
# commit
git add -A
git commit -m "[build] $VERSION"
# publish
git push origin refs/tags/v$VERSION
git push
npm publish
fi