]> git.ipfire.org Git - ipfire.org.git/blob - static/scss/bootstrap-4.0.0-alpha.6/grunt/upload-preview.sh
.gitignore: Add .vscode
[ipfire.org.git] / static / scss / bootstrap-4.0.0-alpha.6 / grunt / upload-preview.sh
1 #!/bin/bash
2 # Upload built docs to preview.twbsapps.com
3
4 if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ]; then exit 0; fi
5
6 # Add build metadata to version
7 sed -i "/^current_version:/ s/\$/+pr.${TRAVIS_COMMIT}/" _config.yml
8 # Fix URLs since the site's root is now a subdirectory
9 echo "baseurl: /c/${TRAVIS_COMMIT}" >> _config.yml
10 bundle exec jekyll build --destination "$TRAVIS_COMMIT"
11
12 # Install gcloud & gsutil
13 GSUTIL_VERSION=$(gsutil version | cut -d ' ' -f 3)
14 if [ ! -d "${HOME}/google-cloud-sdk" ] || [ "${GSUTIL_VERSION}" != '4.19' ]; then
15 rm -rf "${HOME}/google-cloud-sdk" # Kill Travis' outdated non-updateable preinstalled version
16 echo 'Installing google-cloud-sdk...'
17 export CLOUDSDK_CORE_DISABLE_PROMPTS=1
18 time (curl -S -s https://sdk.cloud.google.com | bash &>/dev/null)
19 echo 'Done.'
20 fi
21 source "${HOME}/google-cloud-sdk/path.bash.inc"
22
23 openssl aes-256-cbc -K $encrypted_2b749c8e6327_key -iv $encrypted_2b749c8e6327_iv -in grunt/gcp-key.json.enc -out grunt/gcp-key.json -d
24 gcloud auth activate-service-account "$GCP_SERVICE_ACCOUNT" --key-file grunt/gcp-key.json &> /dev/null || (echo 'GCP login failed!'; exit 1)
25
26 echo "Uploading to http://preview.twbsapps.com/c/${TRAVIS_COMMIT} ..."
27 time gsutil -q -m cp -z html,css,js,svg -r "./${TRAVIS_COMMIT}" gs://preview.twbsapps.com/c/
28 echo 'Done.'