|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +# Copyright 2014 Google Inc. All rights reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
3 | 17 | set -ev |
4 | 18 |
|
5 | | -# If merging to master and not a pull request, update docs. |
6 | | -if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then |
7 | | - # Generate new set of json files in docs/json/master. |
| 19 | +if [[ "${TRAVIS_BRANCH}" == "master" ]] && \ |
| 20 | + [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then |
| 21 | + # Build new docset in docs/_build from master. |
8 | 22 | tox -e docs |
9 | | - git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages |
| 23 | + git submodule add -b gh-pages \ |
| 24 | + "https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME}" \ |
| 25 | + ghpages |
10 | 26 | cp -R docs/_build/html/* ghpages/ |
11 | 27 | cd ghpages |
12 | 28 | git add . |
13 | 29 | # Commit to gh-pages branch to apply changes. |
14 | 30 | git config user.name "selfiebot" |
15 | 31 | git commit -m "Update docs after merge to master." |
16 | | - git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages |
| 32 | + git push \ |
| 33 | + "https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME}" \ |
| 34 | + HEAD:gh-pages |
| 35 | +else |
| 36 | + echo "Not in master on a non-pull request. Doing nothing." |
17 | 37 | fi |
0 commit comments