set -e
: ${TRAVIS:?'This should only be run on Travis CI'}
TAG=${1:?'Must provide tag'}
git fetch origin gh-pages
git checkout -b gh-pages FETCH_HEAD
mv target/doc docs/$TAG
sed -i '' -e '/<!-- DOCS INDEX -->/i\
<li><a href="docs/'"$TAG"'/roaring/">'"$TAG"'</a></li>' \
index.html
git add docs/$TAG
git add index.html
git commit -m "Add API docs for $TAG"
git push origin gh-pages:gh-pages