-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathpublish.sh
executable file
·59 lines (48 loc) · 1.22 KB
/
publish.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
#!/bin/bash -ue
# Failsafe
set -ue
WEBROOT="jubatus.github.com"
JUBAKIT="jubakit"
# Make sure that we're on `master` branch of website repository
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
echo "You must be on the master branch to publish."
exit 1
fi
# Build Jubatus documents
omake clean html
# Build Jubakit documents
if [ ! -d "${JUBAKIT}" ]; then
git clone [email protected]:jubatus/jubakit.git "${JUBAKIT}"
fi
pushd "${JUBAKIT}"
git checkout master
git pull
pushd "doc"
./build.sh
popd
popd
# Clone hosting repository
if [ ! -d "${WEBROOT}" ]; then
git clone [email protected]:jubatus/jubatus.github.com.git "${WEBROOT}"
fi
pushd "${WEBROOT}"
git checkout master
git pull
# Remove existing files in hosting repository
find . -mindepth 1 -and \
! \( -path "./.*" -or -name CNAME \) \
-delete
# Copy Jubatus documents
cp -a ../build/html/* .
# Copy Jubakit documents
cp -a ../${JUBAKIT}/doc/_build/en/html/* en/jubakit
cp -a ../${JUBAKIT}/doc/_build/ja/html/* ja/jubakit
# To test this script without actually publishing the docs, exit here.
# exit
# Commit and publish
git add -A
if git commit -m "autocommit by publish.sh"; then
git push origin master
else
echo "Nothing to commit: website is up-to-date."
fi