-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpublish-docs.sh
executable file
·79 lines (59 loc) · 1.19 KB
/
publish-docs.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
68
69
70
71
72
73
74
75
76
77
78
79
sitepath=`pwd`
contentpath="../skinny"
if [ "$1" != "" ]; then
contentpath=$1
fi
echo "Writing site from $contentpath to $sitepath"
cd $contentpath
if [ $? != 0 ]
then
echo "Content directory $contentpath could not be found: exiting."
exit $?
fi
#switch the content to the master branch
git checkout master
if [ $? != 0 ]
then
echo "Could not checkout master branch, probably uncommitted changes: exiting."
exit $?
fi
#generate the dist
grunt build
if [ $? != 0 ]
then
echo "Grunt build failed for skinny.js: exiting."
exit $?
fi
cd $sitepath
# Build the site
grunt
if [ $? != 0 ]
then
echo "Grunt build failed for skinny site: exiting."
exit $?
fi
# Go back to skinny, where the gh-pages branch is.
# We need to put the site there
cd $contentpath
git checkout gh-pages
if [ $? != 0 ]
then
echo "Could not checkout gh-pages branch, probably uncommitted changes: exiting."
exit $?
fi
# Clear the directory of anything that could cause a conflict
git fetch origin
git reset --hard origin/gh-pages
cp -R $sitepath/site/_site/* .
git add -A
git commit -m "Updating documentation"
if [ $? != 0 ]
then
exit $?
fi
git push
if [ $? != 0 ]
then
exit $?
fi
git checkout master