-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-gh-pages.sh
62 lines (49 loc) · 1.36 KB
/
build-gh-pages.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
53
54
55
56
57
58
59
60
61
62
# Shell script to build gh-pages.
# Run from root directory.
# define your rebase directory
BASE_DIR=/nextprot-snorql/
[ -n "$1" ] && BASE_DIR=$1
[ -n "$2" ] && DEST=$2
# exit on control+c
control_c(){
echo -en "\n*** Ouch! Exiting ***\n"
exit 1
}
echo "deploying application on $DEST with base-url: $BASE_DIR"
# check if file app.js exists
[ -f app.js ] || {
echo "run $0 from root directory"
exit 1
}
# check if brunch exists
[ -f node_modules/.bin/brunch ] || {
echo "brunch is not there, did you ran npm install"
exit 1
}
# build current version of the aplication
BASE=$BASE_DIR ./node_modules/.bin/brunch build -P
# switch branch to gh-pages
git checkout gh-pages
# check if index.html exists
[ -f index.html ] ||{
echo "issue on checkout branch gh-pages"
exit 1
}
# where destination is not github
[ -n "$DEST" ] && {
# rsync -e ssh -auvz --delete-after . npteam@plato:/work/www/snorql.nextprot.org/
rsync -e ssh -auvz --delete-after build/ $DEST
git commit -m "deploy inhouse new version" .
git checkout master
exit 0;
}
# make it happy
git pull origin gh-pages
git fetch --all
git reset --hard origin/gh-pages
# remove everything and copy the new version
rm -rf css fonts js partials && cp -a build/* .
git add --all
git commit -m "deploy github new version" .
echo "READY to deploy in github gh-pages"
git push origin gh-pages; git checkout master