From 0b2e1a6b40ce0b014a42d506e7a1aab4241ae31d Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 30 Apr 2018 14:12:24 -0700 Subject: [PATCH] Add update_docs.sh script for docs generation Change-Id: I6195dc84cf0ecf69680d857b35320b068a9c54fb --- docs/update_docs.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/update_docs.sh diff --git a/docs/update_docs.sh b/docs/update_docs.sh new file mode 100644 index 0000000000..c4f7638194 --- /dev/null +++ b/docs/update_docs.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright 2018 Google LLC. All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd +# +# This script is expected to run in src/ directory. +# ./docs/update_docs.sh {SHOULD_RUN_DOXYGEN:default true} \ +# {SITE_DIRECTORY: default unset} + +set -ev + +SHOULD_RUN_DOXYGEN=${1:-true} +SITE_DIRECTORY=${2} + +rev=$(git rev-parse HEAD) + +if [ "${SHOULD_RUN_DOXYGEN}" = true ] ; then + doxygen docs/Doxyfile +fi +cd docs +make html + +cd ../out +rm -rf gh-pages + +# If SITE_DIRECTORY is specified, it is assumed to be local evaluation, so we +# will not try to update Git repository. +if [[ -z ${SITE_DIRECTORY} ]] ; then + git clone --depth 1 https://github.com/google/shaka-packager -b gh-pages gh-pages + cd gh-pages + git rm -rf * + mv ../sphinx/html html + if [ "${SHOULD_RUN_DOXYGEN}" = true ] ; then + mv ../doxygen/html docs + fi + git add * + git commit -m "Generate documents for commit ${rev}" +else + rm -rf ${SITE_DIRECTORY} + mkdir ${SITE_DIRECTORY} + mv sphinx/html ${SITE_DIRECTORY}/html + if [ "${SHOULD_RUN_DOXYGEN}" = true ] ; then + mv doxygen/html ${SITE_DIRECTORY}/docs + fi + chmod -R 755 ${SITE_DIRECTORY} +fi