UNPKG

760 Bapplication/x-shView Raw
1#!/bin/bash
2# Based on https://github.com/hydrabolt/discord.js-site/blob/master/deploy/deploy.sh
3
4set -e
5
6if [ "$TRAVIS_BRANCH" != "master" -o -n "$TRAVIS_TAG" -o "$TRAVIS_PULL_REQUEST" != "false" ]; then
7 echo -e "Not building for a non master branch push - building without deploying."
8 npm run docs
9 exit 0
10fi
11
12echo -e "Building for a master branch push - building and deploying."
13
14REPO=$(git config remote.origin.url)
15SHA=$(git rev-parse --verify HEAD)
16
17TARGET_BRANCH="gh-pages"
18git clone $REPO dist -b $TARGET_BRANCH
19
20npm run docs
21
22rsync -vau docs/ dist/
23
24cd dist
25git add --all .
26git config user.name "Travis CI"
27git config user.email "${COMMIT_EMAIL}"
28git commit -m "Docs build: ${SHA}" || true
29git push "https://${GH_TOKEN}@${GH_REF}" $TARGET_BRANCH