travis-gh-pages 872 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -e
  3. if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
  4. git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && {
  5. rm -rf ../gh-pages
  6. git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages
  7. mkdir -p ../gh-pages/_source
  8. cp *.md ../gh-pages/_source
  9. cp LICENSE ../gh-pages/_source
  10. currentDir=$(pwd)
  11. cd ../gh-pages
  12. $currentDir/node_modules/.bin/gh-pages-generator
  13. # remove logo from README
  14. sed -i -E "s/<img[^>]+ajv_logo[^>]+>//" index.md
  15. git config user.email "$GIT_USER_EMAIL"
  16. git config user.name "$GIT_USER_NAME"
  17. git add .
  18. git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER"
  19. git push --quiet origin gh-pages > /dev/null 2>&1
  20. }
  21. fi