Deploy docs to gh-pages branch from Travis builds
authorKhaled Hosny <khaledhosny@eglug.org>
Mon, 14 Dec 2015 19:33:51 +0000 (23:33 +0400)
committerKhaled Hosny <khaledhosny@eglug.org>
Wed, 23 Dec 2015 21:52:17 +0000 (01:52 +0400)
Build docs in Travis and push them to the gh-pages branch, which makes
them available at http://behdad.github.io/harfbuzz/

.ci/deploy-docs.sh [new file with mode: 0755]
.travis.yml

diff --git a/.ci/deploy-docs.sh b/.ci/deploy-docs.sh
new file mode 100755 (executable)
index 0000000..8c60a22
--- /dev/null
@@ -0,0 +1,25 @@
+set -o errexit -o nounset
+
+if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" -a "$TRAVIS_PULL_REQUEST" == "false" -a "$TRAVIS_BRANCH" == "master" ]
+then
+       DOCSDIR=build-docs
+       REVISION=$(git rev-parse --short HEAD)
+
+       rm -rf $DOCSDIR || exit
+       mkdir $DOCSDIR
+       cd $DOCSDIR
+
+       cp ../docs/html/* .
+
+       git init
+       git config user.name "Travis CI"
+       git config user.email "travis@harfbuzz.org"
+       git remote add upstream "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git"
+       git fetch upstream
+       git reset upstream/gh-pages
+
+       touch .
+       git add -A .
+       git commit -m "Rebuild docs for $REVISION"
+       git push -q upstream HEAD:gh-pages
+fi
index 817811c..798f5ee 100644 (file)
@@ -13,6 +13,7 @@ env:
     - CFLAGS="-Werror --coverage"
     - CXXFLAGS="-Werror --coverage"
     - LDFLAGS="--coverage"
+    - secure: "EysLG1MB6WCvDVpls5jsJAYsXcbHTmSFYl11UlAQCNfU+MBv7qiuOR6im3tM4ISzt4TY+OQXxEktMFRT+8govLR4UWo8dwmZ4P/2GqMbsZNPVSLkbDEy6hVv7xe5X4mp+npHthY1Z1YOLKGAh/u1PymySZz6qAzsCZ6Fq/H5Ri8="
 install:
   - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user nose; fi
   - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user cpp-coveralls; fi # for coveralls.io code coverage tracking
@@ -23,11 +24,14 @@ install:
 script:
   - NOCONFIGURE=1 ./autogen.sh
   - export CONFIGURE_OPTS="--with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2"
+  - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" ]; then export CONFIGURE_OPTS="$CONFIGURE_OPTS  --enable-gtk-doc"; fi
   - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export CONFIGURE_OPTS="$CONFIGURE_OPTS --with-coretext"; fi
   - ./configure $CONFIGURE_OPTS
   - make
   - make check
   - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" ]; then rm -f src/.libs/NONE.gcov; touch src/NONE; coveralls; fi
+after_success:
+  - bash .ci/deploy-docs.sh
 notifications:
   irc: "irc.freenode.org#harfbuzz"
   email: harfbuzz@lists.freedesktop.org