UNPKG

1.18 kBapplication/x-shView Raw
1#!/bin/bash
2
3set -e
4
5if ! 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
12fi
13
14# Adapted from https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
15
16SOURCE_BRANCH="master"
17BUILD_BRANCH="docs"
18
19# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
20if [ "$CI" == "true" ]; then
21 if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
22 echo "Skipping docs deploy."
23 exit 0
24 fi
25fi
26
27# Save some useful information
28REPO=`git config remote.origin.url`
29SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
30SHA=`git rev-parse --verify HEAD`
31
32# Clone the repo and checkout the build branch, and install build dependencis
33git clone $REPO docs-build
34cd docs-build
35git checkout $BUILD_BRANCH
36yarn install
37
38# Build the docs into a temporary dist folder (because broccoli can't build into
39# an existing directory)
40npm run build
41npm run deploy