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