From 13978a9dcd1b200cc9b0a22715755eee52bb328d Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Wed, 15 Mar 2017 14:16:34 -0400 Subject: [PATCH] ci: build docs for tagged commits (#2089) --- circle.yml | 6 ++++++ scripts/circle/post-test.sh | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000000..ab27ddcc396 --- /dev/null +++ b/circle.yml @@ -0,0 +1,6 @@ +deployment: + release: + tag: /.+/ + owner: GoogleCloudPlatform + commands: + - ./scripts/circle/post-test.sh diff --git a/scripts/circle/post-test.sh b/scripts/circle/post-test.sh index a2d3b3ae441..641d4a83812 100755 --- a/scripts/circle/post-test.sh +++ b/scripts/circle/post-test.sh @@ -16,15 +16,28 @@ set -e -if [ "${CIRCLE_BRANCH}" != "master" ] && [ "${CI_PULL_REQUEST}" != "" ] +if [ "${CIRCLE_BRANCH}" != "master" ] && + [ "${CI_PULL_REQUEST}" != "" ] && + [ "${CIRCLE_TAG}" == "" ] then # Not a push to master, so no doc updates required. exit 0 fi +# For a tagged build, we will build the docs for the associated module. +# Otherwise, it will build for master. +export TAGGED_MODULE_NAME=${CIRCLE_TAG/-*} +export TAGGED_MODULE_VERSION=${CIRCLE_TAG/*-} + +if [ "${CIRCLE_TAG:0:1}" == "v" ] +then + export TAGGED_MODULE_NAME="google-cloud" + export TAGGED_MODULE_VERSION=${CIRCLE_TAG:1} +fi + set +e # allows `git` commands during prepare-ghpages to fail -npm run prepare-ghpages +npm run prepare-ghpages $TAGGED_MODULE_NAME $TAGGED_MODULE_VERSION cd gh-pages git fetch origin