#!/bin/bash
set -e
export PATH="$HOME/.local/bin:$PATH"

if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then
  echo '<meta http-equiv="refresh" content="0;url=fringe/">' > target/doc/index.html
  ghp-import -n target/doc
  git remote set-url origin "https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}"
  git push -f origin gh-pages
fi
