-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate-gh-pages.sh
executable file
·67 lines (53 loc) · 1.72 KB
/
generate-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
63
64
65
66
67
#!/usr/bin/env bash
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
BLUE='\033[34m'
MAGENTA='\033[35m'
CYAN='\033[36m'
WHITE='\033[37m'
GRAY="\033[1;30m"
LIGHT_GRAY="\033[37m"
NO_COLOUR="\033[0m"
LINE="$GRAY--------------------------------------------------------------------------------$NO_COLOUR"
echo -e "$GRAY-------------------------------------------[$CYAN neuro gh-pages generator$YELLOW 0.0.2$GRAY ]-"
echo -e ""
echo -e " $YELLOW($BLUE'$MAGENTA.$BLUE'$YELLOW)"
echo -e " $YELLOW<$WHITE))$YELLOW=$ "
echo -e " $BLUE _/\_ $GRAY foo[tm]$NO_COLOUR"
if [ -n "$(git status --porcelain)" ]; then
echo -e $RED
echo -e "ERROR:$WHITE git status$RED was not clean. Please, commit your changes first."
echo -e $LINE
git status
echo -e $LINE
exit 1
else
echo -e $GREEN
echo -e "Current branch is$WHITE clean$GREEN, checking out$CYAN gh-pages$GREEN..."
echo -e
git checkout gh-pages
if [ -n "$(git status --porcelain)" ]; then
git reset --hard HEAD
fi
echo -e $LINE
echo -e "Checking and getting dependencies via npm install..."
npm install .
echo -e $LINE
echo -e "running$CYAN build.js$LIGHT_GRAY via$CYAN npm run-script build$NO_COLOUR..."
npm run-script build
rc=$?
if [[ $rc != 0 ]]; then
echo -e $RED
echo "ERROR: build.js has failed (exit code $rc). check logs and package.json, exiting..."
echo -e $LINE
exit $rc
fi
git add index.html
git commit -m'automatically generated gh-pages'
git push origin gh-pages
echo -e $LINE
echo -e "All done, going back to$CYAN master$NO_COLOUR now."
git checkout master
fi
echo -e $LINE