aboutsummaryrefslogtreecommitdiff
path: root/grunt
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2016-06-27 14:19:10 -0700
committerGitHub <[email protected]>2016-06-27 14:19:10 -0700
commite95e9fed09a4ef19d093ad8c44611da396c61d01 (patch)
treeff6824a2177ddb5501259fe01d878bc9a90a8bcb /grunt
parentbba039d2fd1ffbd95a03589e9e87fd55cb273302 (diff)
downloadbootstrap-e95e9fed09a4ef19d093ad8c44611da396c61d01.tar.xz
bootstrap-e95e9fed09a4ef19d093ad8c44611da396c61d01.zip
Allow PRs to be previewed at http://preview.twbsapps.com (#20179)
Diffstat (limited to 'grunt')
-rw-r--r--grunt/gcp-key.json.encbin0 -> 2304 bytes
-rwxr-xr-xgrunt/upload-preview.sh28
2 files changed, 28 insertions, 0 deletions
diff --git a/grunt/gcp-key.json.enc b/grunt/gcp-key.json.enc
new file mode 100644
index 000000000..6e1856a2f
--- /dev/null
+++ b/grunt/gcp-key.json.enc
Binary files differ
diff --git a/grunt/upload-preview.sh b/grunt/upload-preview.sh
new file mode 100755
index 000000000..905d716ab
--- /dev/null
+++ b/grunt/upload-preview.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Upload built docs to preview.twbsapps.com
+
+if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ]; then exit 0; fi
+
+# Add build metadata to version
+sed -i "/^current_version:/ s/\$/+pr.${TRAVIS_COMMIT}/" _config.yml
+# Fix URLs since the site's root is now a subdirectory
+echo "baseurl: /c/${TRAVIS_COMMIT}" >> _config.yml
+bundle exec jekyll build --destination "$TRAVIS_COMMIT"
+
+# Install gcloud & gsutil
+GSUTIL_VERSION=$(gsutil version | cut -d ' ' -f 3)
+if [ ! -d "${HOME}/google-cloud-sdk" ] || [ "${GSUTIL_VERSION}" != '4.19' ]; then
+ rm -rf "${HOME}/google-cloud-sdk" # Kill Travis' outdated non-updateable preinstalled version
+ echo 'Installing google-cloud-sdk...'
+ export CLOUDSDK_CORE_DISABLE_PROMPTS=1
+ time (curl -S -s https://sdk.cloud.google.com | bash &>/dev/null)
+ echo 'Done.'
+fi
+source "${HOME}/google-cloud-sdk/path.bash.inc"
+
+openssl aes-256-cbc -K $encrypted_2b749c8e6327_key -iv $encrypted_2b749c8e6327_iv -in grunt/gcp-key.json.enc -out grunt/gcp-key.json -d
+gcloud auth activate-service-account "$GCP_SERVICE_ACCOUNT" --key-file grunt/gcp-key.json &> /dev/null || (echo 'GCP login failed!'; exit 1)
+
+echo "Uploading to http://preview.twbsapps.com/c/${TRAVIS_COMMIT} ..."
+time gsutil -q -m cp -z html,css,js,svg -r "./${TRAVIS_COMMIT}" gs://preview.twbsapps.com/c/
+echo 'Done.'