Deploy docs to gh-pages branch from Travis builds
Build docs in Travis and push them to the gh-pages branch, which makes
them available at http://behdad.github.io/harfbuzz/
diff --git a/.ci/deploy-docs.sh b/.ci/deploy-docs.sh
new file mode 100755
index 0000000..8c60a22
--- /dev/null
+++ b/.ci/deploy-docs.sh
@@ -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 "[email protected]"
+ git remote add upstream "https://[email protected]/$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