-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·52 lines (43 loc) · 1.39 KB
/
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
51
52
#!/bin/bash
LAST_TAG=`git describe --tags --match 'v*' --abbrev=0`
git pull || exit
if [ "$1" != "dist" -a -n "$1" ]; then
TAG="$1"
if [ -z "`grep -E '^## '"$TAG"'$' README.md`" ]; then
echo "Please update README.md:"
echo "## $TAG"
echo "#### New features:"
echo "#### Fixes:"
../../../utils/git-log-since-tag.sh $LAST_TAG | awk '{print "- " $0}'
exit 1
fi
awk '/^## v[0-9.]*$/ { first++ } { if (first == 1) {print }}' README.md
read -p "Commit and release? (y/N) " ANSWER
if [ "$ANSWER" != "y" ]; then
exit 2
fi
sed -i 's/"version": ".*",/"version": "'"$TAG"'",/' package.json
echo "Releasing $TAG"
else
echo "Usage:"
echo " $0 Compile the code"
echo " $0 dist Compile the code and push dist but don't release with a tag"
echo " $0 <tag> Compile the code and release with a tag"
echo
echo "Last released version was $LAST_TAG"
echo "Building test version"
fi
(cd app/sass/; ./compile.sh) || exit -1
grunt || exit -1
if [ "$1" == "dist" ]; then
git add app/css/main.css app/css/main.css.map app/info.json package.json dist/ &&
git commit -m "dist" &&
git push &&
git push
fi
if [ -n "$TAG" ]; then
git add README.md app/css/main.css app/css/main.css.map app/info.json package.json dist/ &&
git commit -m "dist" && git tag "$TAG" &&
git push && git push --tags &&
git checkout master && git merge dev && git push && git checkout dev # merge with master
fi