-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis-generate-docs.sh
executable file
·51 lines (40 loc) · 1.13 KB
/
.travis-generate-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
#!/bin/bash -x
echo "Generating docs with doxygen..."
doxygen
mkdir -p ~/.ssh
chmod 0600 ~/znc-docs-key
cat <<EOF >> ~/.ssh/config
Host znc-docs
HostName github.com
User git
IdentityFile ~/znc-docs-key
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF
cd "$HOME"
git config --global user.email "[email protected]"
git config --global user.name "znc-travis"
git clone --depth=1 --branch=gh-pages znc-docs:znc/docs.git gh-pages || exit 1
cd "$TRAVIS_BUILD_DIR/doc/html/"
mv ~/gh-pages/.git ./
echo docs.znc.in > CNAME
git add -A
rm -f ~/docs_need_commit
git status
git status | perl -ne '/modified:\s+(.*)/ and print "$1\n"' | while read x; do
echo Checking for useful changes: $x
git diff --cached $x |
perl -ne '/^[-+]/ and !/^([-+])\1\1 / and !/^[-+]Generated.*ZNC.*doxygen/ and exit 1' &&
git reset -q $x ||
{ echo Useful change detected; touch ~/docs_need_commit; }
done
if [[ ! -f ~/docs_need_commit ]]; then
echo "Docs at gh-pages are up to date."
exit
fi
git commit -F- <<EOF
Latest docs on successful travis build $TRAVIS_BUILD_NUMBER
ZNC commit $TRAVIS_COMMIT
EOF
git push origin gh-pages
echo "Published docs to gh-pages."