1 | #!/bin/bash
|
2 |
|
3 | set -e
|
4 |
|
5 | if ! hash aws 2>/dev/null; then
|
6 | echo "AWS CLI not found, installing locally"
|
7 | curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
|
8 | unzip awscli-bundle.zip
|
9 | ./awscli-bundle/install -b ~/bin/aws
|
10 | export PATH=~/bin:$PATH
|
11 | aws configure set preview.cloudfront true
|
12 | fi
|
13 |
|
14 |
|
15 |
|
16 | SOURCE_BRANCH="master"
|
17 | BUILD_BRANCH="docs"
|
18 |
|
19 |
|
20 | if [ "$CI" == "true" ]; then
|
21 | if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
|
22 | echo "Skipping docs deploy."
|
23 | exit 0
|
24 | fi
|
25 | fi
|
26 |
|
27 |
|
28 | REPO=`git config remote.origin.url`
|
29 | SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
|
30 | SHA=`git rev-parse --verify HEAD`
|
31 |
|
32 |
|
33 | git clone $REPO docs-build
|
34 | cd docs-build
|
35 | git checkout $BUILD_BRANCH
|
36 | yarn install
|
37 |
|
38 |
|
39 |
|
40 | npm run build
|
41 | npm run deploy
|