|
42 | 42 | exit $? |
43 | 43 | fi |
44 | 44 |
|
45 | | -# Adding GitHub pages branch. `git submodule add` checks it |
46 | | -# out at HEAD. |
47 | | -GH_PAGES_DIR='ghpages' |
48 | | -git submodule add -q -b gh-pages \ |
49 | | - "git@github.com:${GH_OWNER}/${GH_PROJECT_NAME}" ${GH_PAGES_DIR} |
50 | | - |
51 | | -# Determine if we are building a new tag or are building docs |
52 | | -# for master. Then build new docs in docs/_build from master. |
53 | | -if [[ -n "${CIRCLE_TAG}" ]]; then |
54 | | - # Sphinx will use the package version by default. |
55 | | - build_docs |
56 | | -else |
57 | | - SPHINX_RELEASE=$(git log -1 --pretty=%h) build_docs |
58 | | -fi |
59 | | - |
60 | | -# Get the current version. |
61 | | -# This is only likely to work from within nox, because the google-cloud |
62 | | -# package must be installed. |
63 | | -CURRENT_VERSION=$(python ${DIR}/get_version.py) |
64 | | - |
65 | | -# Update gh-pages with the created docs. |
66 | | -cd ${GH_PAGES_DIR} |
67 | | -git rm -fr latest/ |
68 | | -cp -R ../docs/_build/html/ latest/ |
69 | | - |
70 | | -# Update the files push to gh-pages. |
71 | | -git add . |
72 | | -git status |
73 | | - |
74 | | -# If there are no changes, just exit cleanly. |
75 | | -if [[ -z "$(git status --porcelain)" ]]; then |
76 | | - echo "Nothing to commit. Exiting without pushing changes." |
77 | | - exit |
78 | | -fi |
79 | | - |
80 | | -# Commit to gh-pages branch to apply changes. |
81 | | -git config --global user.email "googleapis-publisher@google.com" |
82 | | -git config --global user.name "Google APIs Publisher" |
83 | | -git commit -m "Update docs after merge to master." |
84 | | - |
85 | | -# NOTE: This may fail if two docs updates (on merges to master) |
86 | | -# happen in close proximity. |
87 | | -git push -q origin HEAD:gh-pages |
0 commit comments