From be723396eb02954deed413fdb8506cf1242fe358 Mon Sep 17 00:00:00 2001 From: Jose Nino Date: Tue, 14 Feb 2017 14:18:22 -0800 Subject: [PATCH 1/6] docs: automatic publish on master --- ci/ci_steps.sh | 3 +++ docs/publish.sh | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ci/ci_steps.sh b/ci/ci_steps.sh index b831621d1e4c0..1387d4d2a4773 100755 --- a/ci/ci_steps.sh +++ b/ci/ci_steps.sh @@ -13,3 +13,6 @@ docker run -t -i -v $TRAVIS_BUILD_DIR:/source lyft/envoy-build:5ba9f93b749aaabdc ./ci/docker_push.sh # This script runs on every PRs normal run to test the docker examples. ./ci/verify_examples.sh + +# This make target publishes envoy's web site on a push to master. +make publish_docs diff --git a/docs/publish.sh b/docs/publish.sh index 70f91c839e2f2..fbfc7c0b35ac9 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -6,16 +6,16 @@ DOCS_DIR=$1 PUBLISH_DIR=$2 BUILD_SHA=`git rev-parse HEAD` -if [[ ! -d $PUBLISH_DIR ]]; then - echo "$PUBLISH_DIR does not exist. Clone a fresh envoy repo." +if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$TEST_TYPE" == "normal" ] +then + git clone https://GH_TOKEN@github.com/lyft/envoy $PUBLISH_DIR + git -C $PUBLISH_DIR config user.name "Publish Docs" + git -C $PUBLISH_DIR config user.email GH_EMAIL + git -C $PUBLISH_DIR fetch + git -C $PUBLISH_DIR checkout -B gh-pages origin/gh-pages + rm -fr $PUBLISH_DIR/* + cp -r $DOCS_DIR/* $PUBLISH_DIR + git -C $PUBLISH_DIR add . + git -C $PUBLISH_DIR commit -m "docs @$BUILD_SHA" + git -C $PUBLISH_DIR push origin gh-pages fi - -git -C $PUBLISH_DIR fetch -git -C $PUBLISH_DIR checkout -B gh-pages origin/gh-pages -rm -fr $PUBLISH_DIR/* -cp -r $DOCS_DIR/* $PUBLISH_DIR -git -C $PUBLISH_DIR add . -git -C $PUBLISH_DIR commit -m "docs @$BUILD_SHA" - -echo -echo "*** YOU MUST MANUALLY PUSH the gh-pages branch after verifying the commit ***" From c02d8cd16b7dae1005444a04033fa5974c6fa9a9 Mon Sep 17 00:00:00 2001 From: Jose Nino Date: Tue, 14 Feb 2017 14:21:15 -0800 Subject: [PATCH 2/6] format --- docs/publish.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/publish.sh b/docs/publish.sh index fbfc7c0b35ac9..d16d978508403 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -6,16 +6,17 @@ DOCS_DIR=$1 PUBLISH_DIR=$2 BUILD_SHA=`git rev-parse HEAD` -if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$TEST_TYPE" == "normal" ] +if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] &&\ + [ "$TEST_TYPE" == "normal" ] then git clone https://GH_TOKEN@github.com/lyft/envoy $PUBLISH_DIR - git -C $PUBLISH_DIR config user.name "Publish Docs" - git -C $PUBLISH_DIR config user.email GH_EMAIL + #git -C $PUBLISH_DIR config user.name "Publish Docs" + #git -C $PUBLISH_DIR config user.email GH_EMAIL git -C $PUBLISH_DIR fetch git -C $PUBLISH_DIR checkout -B gh-pages origin/gh-pages rm -fr $PUBLISH_DIR/* cp -r $DOCS_DIR/* $PUBLISH_DIR git -C $PUBLISH_DIR add . git -C $PUBLISH_DIR commit -m "docs @$BUILD_SHA" - git -C $PUBLISH_DIR push origin gh-pages + #git -C $PUBLISH_DIR push origin gh-pages fi From 986ad3886a67f93b6a9fab0acffe949fef12082b Mon Sep 17 00:00:00 2001 From: Jose Ulises Nino Rivera Date: Tue, 14 Feb 2017 14:41:05 -0800 Subject: [PATCH 3/6] uncomment --- docs/publish.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/publish.sh b/docs/publish.sh index d16d978508403..1e044f4a227e7 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -10,13 +10,13 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] &&\ [ "$TEST_TYPE" == "normal" ] then git clone https://GH_TOKEN@github.com/lyft/envoy $PUBLISH_DIR - #git -C $PUBLISH_DIR config user.name "Publish Docs" - #git -C $PUBLISH_DIR config user.email GH_EMAIL + git -C $PUBLISH_DIR config user.name "Publish Docs" + git -C $PUBLISH_DIR config user.email GH_EMAIL git -C $PUBLISH_DIR fetch git -C $PUBLISH_DIR checkout -B gh-pages origin/gh-pages rm -fr $PUBLISH_DIR/* cp -r $DOCS_DIR/* $PUBLISH_DIR git -C $PUBLISH_DIR add . git -C $PUBLISH_DIR commit -m "docs @$BUILD_SHA" - #git -C $PUBLISH_DIR push origin gh-pages + git -C $PUBLISH_DIR push origin gh-pages fi From bdd633b6eb04cd82f33a7dbb90f2c31fec4c41d1 Mon Sep 17 00:00:00 2001 From: Jose Nino Date: Tue, 14 Feb 2017 14:58:08 -0800 Subject: [PATCH 4/6] need sudo to create dir --- ci/ci_steps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/ci_steps.sh b/ci/ci_steps.sh index 1387d4d2a4773..0e2f1aeb23e40 100755 --- a/ci/ci_steps.sh +++ b/ci/ci_steps.sh @@ -15,4 +15,4 @@ docker run -t -i -v $TRAVIS_BUILD_DIR:/source lyft/envoy-build:5ba9f93b749aaabdc ./ci/verify_examples.sh # This make target publishes envoy's web site on a push to master. -make publish_docs +sudo make publish_docs From 99c032515bd3f2e56a48972288f5f1166ca6f0f6 Mon Sep 17 00:00:00 2001 From: Jose Nino Date: Tue, 14 Feb 2017 15:28:49 -0800 Subject: [PATCH 5/6] move to docs run --- Makefile | 3 +-- ci/ci_steps.sh | 3 --- ci/do_ci.sh | 2 ++ docs/publish.sh | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0c889da37c084..e89fd104bfd4c 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,5 @@ docs: docs/build.sh $(DOCS_OUTPUT_DIR) .PHONY: publish_docs -publish_docs: docs +publish_docs: docs/publish.sh $(DOCS_OUTPUT_DIR) $(DOCS_PUBLISH_DIR) - diff --git a/ci/ci_steps.sh b/ci/ci_steps.sh index 0e2f1aeb23e40..b831621d1e4c0 100755 --- a/ci/ci_steps.sh +++ b/ci/ci_steps.sh @@ -13,6 +13,3 @@ docker run -t -i -v $TRAVIS_BUILD_DIR:/source lyft/envoy-build:5ba9f93b749aaabdc ./ci/docker_push.sh # This script runs on every PRs normal run to test the docker examples. ./ci/verify_examples.sh - -# This make target publishes envoy's web site on a push to master. -sudo make publish_docs diff --git a/ci/do_ci.sh b/ci/do_ci.sh index bdf1493580fbc..46a4fcf97d0a6 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -9,6 +9,8 @@ echo "building using $NUM_CPUS CPUs" if [[ "$1" == "docs" ]]; then echo "docs build..." make docs + # this target will run a script that will publish docs on a master commit. + make publish_docs exit 0 fi diff --git a/docs/publish.sh b/docs/publish.sh index 1e044f4a227e7..35bcd3e07c384 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -6,8 +6,7 @@ DOCS_DIR=$1 PUBLISH_DIR=$2 BUILD_SHA=`git rev-parse HEAD` -if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] &&\ - [ "$TEST_TYPE" == "normal" ] +if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] then git clone https://GH_TOKEN@github.com/lyft/envoy $PUBLISH_DIR git -C $PUBLISH_DIR config user.name "Publish Docs" From eae970e4da2948c0685f77ae072e9a064cc07338 Mon Sep 17 00:00:00 2001 From: Jose Nino Date: Tue, 14 Feb 2017 15:50:30 -0800 Subject: [PATCH 6/6] remove publish make target --- Makefile | 5 ----- ci/do_ci.sh | 4 ++-- docs/publish.sh | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index e89fd104bfd4c..15e00c92e9164 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,7 @@ DOCS_OUTPUT_DIR ?= generated/docs -DOCS_PUBLISH_DIR ?= ../envoy-docs .PHONY: docs docs: rm -fr generated/docs mkdir -p generated/docs docs/build.sh $(DOCS_OUTPUT_DIR) - -.PHONY: publish_docs -publish_docs: - docs/publish.sh $(DOCS_OUTPUT_DIR) $(DOCS_PUBLISH_DIR) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 46a4fcf97d0a6..1c14ddf38e116 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -9,8 +9,8 @@ echo "building using $NUM_CPUS CPUs" if [[ "$1" == "docs" ]]; then echo "docs build..." make docs - # this target will run a script that will publish docs on a master commit. - make publish_docs + # this target will run a script that will publish docs on a master commit. + docs/publish.sh exit 0 fi diff --git a/docs/publish.sh b/docs/publish.sh index 35bcd3e07c384..c51af270fdbc6 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -2,8 +2,8 @@ set -e -DOCS_DIR=$1 -PUBLISH_DIR=$2 +DOCS_DIR=generated/docs +PUBLISH_DIR=../envoy-docs BUILD_SHA=`git rev-parse HEAD` if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]