Files
weave/site/build-and-publish.sh
T
Ilya Dmitrichenko c9bff8b5a7 Publishing updates to the docs on latest release
This uses a special branch `latest_release_doc_updates`, as don't
require docs to be updated in retrospect for releases other then
the latest.
2015-05-06 16:43:28 +01:00

36 lines
996 B
Bash
Executable File

#!/bin/sh -ex
cd $(dirname $0)/
## Use GCS until we set up Route53/CloudFront/S3
BRANCH=${TRAVIS_BRANCH:-`git rev-parse --abbrev-ref @`}
COMMIT=${TRAVIS_COMMIT:-`git rev-parse @`}
OUTPUT="weave/${BRANCH}/${COMMIT}"
if [ -n "${TRAVIS_TAG}" ]; then
## Travis will run separate build for commit and tag pushes,
OUTPUT="weave/${TRAVIS_TAG}"
fi
if [ "${BRANCH}" = "latest_release_doc_updates" ]; then
OUTPUT="weave/latest_release"
fi
export BRANCH COMMIT OUTPUT
bundle install --path=.bundle
bundle exec jekyll build --verbose
gsutil -m cp -z html,css -a public-read -R _site "gs://docs.weave.works/${OUTPUT}"
echo "Published at http://docs.weave.works/${OUTPUT}"
if [ -z "${TRAVIS_TAG}" ]; then
echo "<meta http-equiv=\"refresh\" content=\"0; url=http://docs.weave.works/${OUTPUT}\" />" \
| gsutil \
-h "Content-Type:text/html" \
-h "Cache-Control:private, max-age=0, no-transform" \
cp -a "public-read" - "gs://docs.weave.works/weave/${BRANCH}/index.html"
fi