File tree Expand file tree Collapse file tree 2 files changed +28
-10
lines changed
Expand file tree Collapse file tree 2 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,19 @@ git submodule add -b gh-pages \
2323 ghpages
2424cp -R docs/_build/html/* ghpages/
2525cd ghpages
26+ # allow "git add" to fail if there aren't new files.
27+ set +e
2628git add .
27- # Commit to gh-pages branch to apply changes.
28- git config user.name " selfiebot"
29- git commit -m " Update docs after merge to master."
30- git push \
31- " https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} " \
32- HEAD:gh-pages
29+ set -e
30+ git status
31+ # H/T: https://github.com/dhermes
32+ if [[ -n " $( git status --porcelain) " ]]; then
33+ # Commit to gh-pages branch to apply changes.
34+ git config user.name " selfiebot"
35+ git commit -m " Update docs after merge to master."
36+ git push \
37+ " https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} " \
38+ HEAD:gh-pages
39+ else
40+ echo " Nothing to commit. Exiting without pushing changes."
41+ fi
Original file line number Diff line number Diff line change @@ -44,9 +44,18 @@ echo "${TRAVIS_COMMIT}" > ${FRESH_REPO_DIR}/LATEST_COMMIT
4444# Display git status and push LATEST_COMMIT. #
4545# #############################################
4646cd ${FRESH_REPO_DIR}
47- git add LATEST_COMMIT
4847
48+ # allow "git add" to fail if there aren't new files.
49+ # this can happen if we re-run builds on travis.
50+ set +e
51+ git add LATEST_COMMIT
52+ set -e
4953git status
50- git commit -m " Main project gcloud-python has been updated."
51- git status
52- git push origin master
54+ # H/T: https://github.com/dhermes
55+ if [[ -n " $( git status --porcelain) " ]]; then
56+ git commit -m " Main project gcloud-python has been updated."
57+ git status
58+ git push origin master
59+ else
60+ echo " Nothing to commit. Exiting without pushing changes."
61+ fi
You can’t perform that action at this time.
0 commit comments