2 # Update Doxygen documentation after push to 'master'.
7 DOXYGEN_VER
=doxygen-1.8
.7
8 DOXYGEN_TAR
=${DOXYGEN_VER}.linux.bin.
tar.gz
9 DOXYGEN_URL
="http://ftp.stack.nl/pub/users/dimitri/${DOXYGEN_TAR}"
10 DOXYGEN_BIN
="/usr/local/bin/doxygen"
12 : ${GITHUB_REPO:="miloyip/rapidjson"}
13 GITHUB_HOST
="github.com"
14 GITHUB_CLONE
="git://${GITHUB_HOST}/${GITHUB_REPO}"
15 GITHUB_URL
="https://${GITHUB_HOST}/${GITHUB_PUSH-${GITHUB_REPO}}"
17 # if not set, ignore password
18 #GIT_ASKPASS="${TRAVIS_BUILD_DIR}/gh_ignore_askpass.sh"
22 echo "Exiting..." 1>&2
28 echo "Exiting..." 1>&2
32 # TRAVIS_BUILD_DIR not set, exiting
33 [ -d "${TRAVIS_BUILD_DIR-/nonexistent}" ] || \
34 abort
'${TRAVIS_BUILD_DIR} not set or nonexistent.'
36 # check for pull-requests
37 [ "${TRAVIS_PULL_REQUEST}" = "false" ] || \
38 skip
"Not running Doxygen for pull-requests."
40 # check for branch name
41 [ "${TRAVIS_BRANCH}" = "master" ] || \
42 skip
"Running Doxygen only for updates on 'master' branch (current: ${TRAVIS_BRANCH})."
44 # check for job number
45 # [ "${TRAVIS_JOB_NUMBER}" = "${TRAVIS_BUILD_NUMBER}.1" ] || \
46 # skip "Running Doxygen only on first job of build ${TRAVIS_BUILD_NUMBER} (current: ${TRAVIS_JOB_NUMBER})."
48 # install doxygen binary distribution
51 wget
-O - "${DOXYGEN_URL}" | \
52 tar xz
-C ${TMPDIR-/tmp} ${DOXYGEN_VER}/bin
/doxygen
53 export PATH
="${TMPDIR-/tmp}/${DOXYGEN_VER}/bin:$PATH"
58 cd "${TRAVIS_BUILD_DIR}";
59 doxygen
${TRAVIS_BUILD_DIR}/build
/doc
/Doxyfile
;
60 doxygen
${TRAVIS_BUILD_DIR}/build
/doc
/Doxyfile.zh-cn
;
65 cd "${TRAVIS_BUILD_DIR}/build/doc";
67 abort
"Doxygen target directory already exists."
69 git clone
-b gh-pages
"${GITHUB_CLONE}" html
71 # setup git config (with defaults)
72 git config user.name
"${GIT_NAME-travis}"
73 git config user.email
"${GIT_EMAIL-"travis@localhost"}"
80 cd "${TRAVIS_BUILD_DIR}/build/doc/html";
81 echo "rapidjson.org" > CNAME
83 git diff-index
--quiet HEAD || git commit
-m "Automatic doxygen build";
87 cat > ${GIT_ASKPASS} <<EOF
92 chmod a
+x
"$GIT_ASKPASS"
96 # check for secure variables
97 [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ] || \
98 skip
"Secure variables not available, not updating GitHub pages."
99 # check for GitHub access token
100 [ "${GH_TOKEN+set}" = set ] || \
101 skip
"GitHub access token not available, not updating GitHub pages."
102 [ "${#GH_TOKEN}" -eq 40 ] || \
103 abort
"GitHub token invalid: found ${#GH_TOKEN} characters, expected 40."
105 cd "${TRAVIS_BUILD_DIR}/build/doc/html";
106 # setup credentials (hide in "set -x" mode)
107 git remote set-url
--push origin
"${GITHUB_URL}"
108 git config credential.helper
'store'
109 # ( set +x ; git config credential.username "${GH_TOKEN}" )
110 ( set +x
; [ -f ${HOME}/.git-credentials
] || \
111 ( echo "https://${GH_TOKEN}:@${GITHUB_HOST}" > ${HOME}/.git-credentials ; \
112 chmod go-rw ${HOME}/.git-credentials ) )
114 git push origin gh-pages