Skip to content

Commit

Permalink
Merge pull request #144 from zopefoundation/auto-generate-release-index
Browse files Browse the repository at this point in the history
Auto-generate the release index on Travis when a tag is made.
  • Loading branch information
tseaver committed Jun 6, 2017
2 parents 48a7386 + 055f532 commit 050a151
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ install:
- buildout install test alltests
script:
- bin/alltests -v
after_success:
# Bails out for non-tags
- ./update_index.sh
notifications:
email: false
cache:
Expand Down
43 changes: 43 additions & 0 deletions update_index.sh
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

0 comments on commit 050a151

Please sign in to comment.