22
33set -e
44
5- function pushDocs () {
65
6+ function buildDocs () {
7+ echo " Building JSON documentation..."
78 PYTHONPATH=_testing python scripts/generate_json_docs.py --tag ${1}
9+ echo " Done building JSON documentation."
10+ }
811
12+
13+ function pushDocs () {
14+ echo " Deploying JSON documentation..."
915 if [[ ! -d " ghpages" ]]; then
1016 git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} ghpages
1117 fi
@@ -23,26 +29,39 @@ function pushDocs () {
2329 echo " Nothing to commit."
2430 fi
2531 cd ..
32+
33+ echo " Done deploying JSON documentation."
2634}
2735
2836function cleanSubmodule () {
29- echo " Cleaning up... "
37+ echo " Cleaning up! "
3038 git submodule deinit -f ghpages
3139 git reset HEAD .gitmodules
3240 git reset HEAD ghpages
3341 rm -rf ghpages
3442 rm -f .gitmodules
3543 rm -rf .git/modules/ghpages
44+ echo " Done cleaning up!"
3645}
3746
47+ # Run this to verifiy that the docs build successfully.
48+ DOC_VERSION=' master'
49+ if [[ ! -z ${TRAVIS_TAG} ]]; then
50+ DOC_VERSION=${TRAVIS_TAG}
51+ else
52+ DOC_VERSION=${TRAVIS_BRANCH}
53+ fi
54+
55+ buildDocs ${DOC_VERSION}
56+
3857if [ " ${TRAVIS_BRANCH} " == " master" ] && [ " ${TRAVIS_PULL_REQUEST} " == " false" ]; then
39- pushDocs $TRAVIS_BRANCH
58+ pushDocs ${DOC_VERSION}
4059 cleanSubmodule
4160 echo " Done pushing docsite. See: https://googlecloudplatform.github.io/gcloud-python/"
4261fi
4362
44- if [[ ! -z $TRAVIS_TAG ]]; then
45- pushDocs $TRAVIS_TAG
63+ if [[ ! -z ${ TRAVIS_TAG} ]]; then
64+ pushDocs ${DOC_VERSION}
4665 cleanSubmodule
4766 echo " Done pushing docsite. See: https://googlecloudplatform.github.io/gcloud-python/"
4867fi
0 commit comments