Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add publish script #104

Merged
merged 5 commits into from
Sep 28, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)

8 changes: 8 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -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`
* Run: `cd ../envoy-docs`
* Verify the latest commit looks OK
* Run: `git push origin gh-pages:gh-pages`
10 changes: 7 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not much care about these, curious about the reason of making version as 0-sha and release as 0sha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo fixing


# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
21 changes: 21 additions & 0 deletions docs/publish.sh
Original file line number Diff line number Diff line change
@@ -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 a fresh envoy 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 ***"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do i need to do anything else after push to origin?

can you put in some docs that, make publish_docs should be enough or we need to do something else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added README, let me know if that looks OK

1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sphinx==1.4.5
sphinx_rtd_theme==0.1.9
sphinxcontrib-httpdomain==1.5.0
GitPython==2.0.8