No Description
haskell

update-gh-pages.sh 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. SOURCE_BRANCH="master"
  3. TARGET_BRANCH="gh-pages"
  4. REPO="https://${GH_TOKEN}@github.com/hasufell/hpath"
  5. DOC_LOCATION="/dist/doc/html/hpath"
  6. # Pull requests and commits to other branches shouldn't try to deploy,
  7. # just build to verify
  8. if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
  9. echo "Skipping docs deploy."
  10. exit 0
  11. fi
  12. cd "$HOME"
  13. git config --global user.email "travis@travis-ci.org"
  14. git config --global user.name "travis-ci"
  15. git clone --branch=${TARGET_BRANCH} ${REPO} ${TARGET_BRANCH} || exit 1
  16. # docs
  17. cd ${TARGET_BRANCH} || exit 1
  18. echo "Removing old docs."
  19. rm -rf *
  20. echo "Adding new docs."
  21. cp -rf "${TRAVIS_BUILD_DIR}${DOC_LOCATION}"/* . || exit 1
  22. # If there are no changes to the compiled out (e.g. this is a README update)
  23. # then just bail.
  24. if [ -z "`git diff --exit-code`" ]; then
  25. echo "No changes to the output on this push; exiting."
  26. exit 0
  27. fi
  28. git add -- .
  29. if [[ -e ./index.html ]] ; then
  30. echo "Commiting docs."
  31. git commit -m "Lastest docs updated
  32. travis build: $TRAVIS_BUILD_NUMBER
  33. commit: $TRAVIS_COMMIT
  34. auto-pushed to gh-pages"
  35. git push origin $TARGET_BRANCH
  36. echo "Published docs to gh-pages."
  37. else
  38. echo "Error: docs are empty."
  39. exit 1
  40. fi