forked from Esri/terraformer-arcgis-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
40 lines (28 loc) · 1.1 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
#!/bin/bash
# config
VERSION=$(node --eval "console.log(require('./package.json').version);")
NAME=$(node --eval "console.log(require('./package.json').name);")
# build and test
npm test || exit 1
# checkout temp branch for release
git checkout -b gh-release
# create built library (and versioned copy)
grunt uglify
# force add files
git add terraformer-arcgis-parser.min.js -f
# commit changes with a versioned commit message
git commit -m "build $VERSION"
# push commit so it exists on GitHub when we run gh-release
git push https://github.com/Esri/terraformer-arcgis-parser gh-release
# create copy of minified file with version number appended
cp terraformer-arcgis-parser.min.js $NAME-$VERSION.min.js
# run gh-release to create the tag and push release to github
gh-release --assets $NAME-$VERSION.min.js
# remove copy after the asset is attached to the github release
rm $NAME-$VERSION.min.js
# checkout master and delete release branch locally and on GitHub
git checkout master
git branch -D gh-release
git push https://github.com/Esri/terraformer-arcgis-parser :gh-release
# publish release on NPM
npm publish