forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_json_docs.sh
More file actions
executable file
·48 lines (41 loc) · 1.29 KB
/
update_json_docs.sh
File metadata and controls
executable file
·48 lines (41 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
function pushDocs () {
PYTHONPATH=_testing python scripts/generate_json_docs.py --tag ${1}
if [[ ! -d "ghpages" ]]; then
git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages
fi
mkdir -p ghpages/json/${1}
cp -R docs/_build/json_build/* ghpages/
cd ghpages
git add .
if [[ -n "$(git status --porcelain)" ]]; then
git config user.name "travis-ci"
git config user.email "travis@travis-ci.org"
git commit -m "Updating docs for ${1}"
git status
git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages
else
echo "Nothing to commit."
fi
cd ..
}
function cleanSubmodule () {
echo "Cleaning up..."
git submodule deinit -f ghpages
git reset HEAD .gitmodules
git reset HEAD ghpages
rm -rf ghpages
rm -f .gitmodules
rm -rf .git/modules/ghpages
}
if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
pushDocs $TRAVIS_BRANCH
cleanSubmodule
echo "Done pushing docsite. See: https://googlecloudplatform.github.io/gcloud-python/"
fi
if [[ ! -z $TRAVIS_TAG ]]; then
pushDocs $TRAVIS_TAG
cleanSubmodule
echo "Done pushing docsite. See: https://googlecloudplatform.github.io/gcloud-python/"
fi