diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-22 19:19:26 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-22 19:19:26 +0100 |
| commit | d42c8b528eb595101954f478e0024e3f079f6fbf (patch) | |
| tree | 61a528cf94f1f6941f4683ae8736a4a0135c035e /templates/assets/bootstrap/grunt/upload-preview.sh | |
| download | minionlivesmatter-d42c8b528eb595101954f478e0024e3f079f6fbf.tar.gz minionlivesmatter-d42c8b528eb595101954f478e0024e3f079f6fbf.zip | |
first implementation of fun stats site
Diffstat (limited to 'templates/assets/bootstrap/grunt/upload-preview.sh')
| -rwxr-xr-x | templates/assets/bootstrap/grunt/upload-preview.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/templates/assets/bootstrap/grunt/upload-preview.sh b/templates/assets/bootstrap/grunt/upload-preview.sh new file mode 100755 index 0000000..08e7fa2 --- /dev/null +++ b/templates/assets/bootstrap/grunt/upload-preview.sh @@ -0,0 +1,27 @@ +#!/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 +bundle exec jekyll build --destination "$TRAVIS_COMMIT" --baseurl "/c/${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.' |
