-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-generate the release index on Travis when a tag is made.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# Update tag-based release indexes on the 'gh-pages' branch. | ||
|
||
set -ev | ||
|
||
# Override locally via e.g., 'GH_HOST=git@github.com: ./update_index.sh' | ||
GH_HOST="${GH_HOST:-https://${GH_OAUTH_TOKEN}@github.com/}" | ||
|
||
GH_OWNER="zopefoundation" | ||
GH_PROJECT_NAME="Zope" | ||
GH_REPO="${GH_HOST}${GH_OWNER}/${GH_PROJECT_NAME}" | ||
|
||
# Only update index if we are on Travis and have a tag # | ||
if [[ -n "${TRAVIS_TAG}" ]]; then | ||
echo "Rebuilding release index on tag: ${TRAVIS_TAG}." | ||
else | ||
echo "No tag, nothing to do." | ||
exit | ||
fi | ||
|
||
# Adding GitHub pages branch. `git submodule add` checks it | ||
# out at HEAD. | ||
GH_PAGES_DIR="ghpages" | ||
git submodule add -q -b gh-pages ${GH_REPO} ${GH_PAGES_DIR} | ||
|
||
# Update gh-pages with the generated release docs. | ||
cd ${GH_PAGES_DIR} | ||
./build_index.sh | ||
|
||
# Update the files push to gh-pages. | ||
git add -A | ||
git status | ||
|
||
if [[ -z "$(git status --porcelain)" ]]; then | ||
echo "Nothing to commit. Exiting without pushing changes." | ||
exit | ||
fi | ||
|
||
# Commit to gh-pages branch to apply changes. | ||
git config --global user.email "travis@travis-ci.org" | ||
git config --global user.name "travis-ci" | ||
git commit -m "Update release index on tag: ${TRAVIS_TAG}." | ||
git push -q ${GH_REPO} HEAD:gh-pages |