diff --git a/site/build-and-publish.sh b/site/build-and-publish.sh
index 76ccd2a3..2f86e9d4 100755
--- a/site/build-and-publish.sh
+++ b/site/build-and-publish.sh
@@ -8,6 +8,11 @@ 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
+
export BRANCH COMMIT OUTPUT
bundle install --path=.bundle
@@ -17,8 +22,10 @@ gsutil -m cp -z html,css -a public-read -R _site "gs://docs.weave.works/${OUTPUT
echo "Published at http://docs.weave.works/${OUTPUT}"
-echo "" \
- | 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"
+if [ -z "${TRAVIS_TAG}" ]; then
+ echo "" \
+ | 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