From 3b72427b4a16ec4ad6b96dc76c0682cfe941fd9d Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Wed, 28 Sep 2016 11:27:54 -0700 Subject: [PATCH 1/5] docs: add publish script --- Makefile | 7 ++++++- docs/conf.py | 10 +++++++--- docs/publish.sh | 21 +++++++++++++++++++++ docs/requirements.txt | 1 + 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100755 docs/publish.sh diff --git a/Makefile b/Makefile index aaed3a20869e..0c889da37c08 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ -VENV := build/venv 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 + docs/publish.sh $(DOCS_OUTPUT_DIR) $(DOCS_PUBLISH_DIR) + diff --git a/docs/conf.py b/docs/conf.py index 2454daca103d..ccf494a3e75b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ import sphinx_rtd_theme import sys import os +import git # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -55,11 +56,14 @@ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -# + +repo = git.Repo('../') +last_commit = str(repo.head.commit)[:6] + # The short X.Y version. -version = u'1.0.0' +version = u'1.1.0-' + last_commit # The full version, including alpha/beta/rc tags. -release = u'1.0.0' +release = u'1.1.0' + last_commit # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/publish.sh b/docs/publish.sh new file mode 100755 index 000000000000..3d0512edb700 --- /dev/null +++ b/docs/publish.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +DOCS_DIR=$1 +PUBLISH_DIR=$2 +BUILD_SHA=`git rev-parse HEAD` + +if [[ ! -d $PUBLISH_DIR ]]; then + echo "$PUBLISH_DIR does not exist. Clone envoy fresh repo." +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 ***" diff --git a/docs/requirements.txt b/docs/requirements.txt index b99fbf0fd6bf..645a3cc7a43e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,4 @@ sphinx==1.4.5 sphinx_rtd_theme==0.1.9 sphinxcontrib-httpdomain==1.5.0 +GitPython==2.0.8 From ff2eba3b21d527a75379c40810ff1af3e1eee6d6 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Wed, 28 Sep 2016 11:34:17 -0700 Subject: [PATCH 2/5] Update publish.sh --- docs/publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/publish.sh b/docs/publish.sh index 3d0512edb700..70f91c839e2f 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -7,7 +7,7 @@ PUBLISH_DIR=$2 BUILD_SHA=`git rev-parse HEAD` if [[ ! -d $PUBLISH_DIR ]]; then - echo "$PUBLISH_DIR does not exist. Clone envoy fresh repo." + echo "$PUBLISH_DIR does not exist. Clone a fresh envoy repo." fi git -C $PUBLISH_DIR fetch From c0a9a0aabc722f91d67b7d4e857c210bcb162e58 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Wed, 28 Sep 2016 11:49:06 -0700 Subject: [PATCH 3/5] add README --- docs/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000000..fa5beb9e2a64 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,8 @@ +How to publish new docs: + +* The docs are contained in the gh-pages branch in the repo. +* Clone a fresh copy of the repo into a parallel envoy-docs directory. +* Run: `make publish_docs` +* Go into ../envoy-docs +* Verify the latest commit looks OK +* Run: `git push origin gh-pages:gh-pages` From 07336832d819463ab8d21325cc8daa8b0b2a9c18 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Wed, 28 Sep 2016 11:50:45 -0700 Subject: [PATCH 4/5] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index fa5beb9e2a64..fbe664acad64 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,6 +3,6 @@ How to publish new docs: * The docs are contained in the gh-pages branch in the repo. * Clone a fresh copy of the repo into a parallel envoy-docs directory. * Run: `make publish_docs` -* Go into ../envoy-docs +* Run: `cd ../envoy-docs` * Verify the latest commit looks OK * Run: `git push origin gh-pages:gh-pages` From 08dca67aee303acbe551eded8ad753e941a09499 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Wed, 28 Sep 2016 11:58:11 -0700 Subject: [PATCH 5/5] Update conf.py --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index ccf494a3e75b..f19418871824 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,7 +63,7 @@ # The short X.Y version. version = u'1.1.0-' + last_commit # The full version, including alpha/beta/rc tags. -release = u'1.1.0' + last_commit +release = u'1.1.0-' + last_commit # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.