forked from usablica/intro.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·47 lines (36 loc) · 844 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
#!/bin/bash
#
# Script for releasing new versions
# Handles version updating and publishing to:
# - GitHub
# - NPM
#
# check package version
VERSION=$(node --eval "console.log(require('./package.json').version);")
LAST=$(git describe --abbrev=0)
if [[ v$VERSION == $LAST ]]; then
echo "Update version in package.json!"
exit 1
fi
# check javascript version
VERSION=$(node --eval "console.log(require('./intro.js').version);")
if [[ v$VERSION == $LAST ]]; then
echo "Update version in ./intro.js!"
exit 1
fi
npm test || exit 1
npm run minify
echo "New Version: $LAST => v$VERSION"
echo "---"
echo "Add a comment?"
read comment
if [[ $comment ]]; then
git commit -am "v$VERSION - $comment"
git tag -a v$VERSION -m "$comment" -f
else
git commit -am "v$VERSION"
git tag v$VERSION -f
fi
git push --tags -f
git push
npm publish