build: include docs in release artifacts + use sphinxcontrib-versioning

refs #35
This commit is contained in:
Christian Schwarz 2017-11-18 16:21:53 +01:00
parent b276787dd4
commit 445a280aa2
5 changed files with 34 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.PHONY: generate build test vet cover release clean
.PHONY: generate build test vet cover release docs docs-clean clean release-bins
.DEFAULT_GOAL := build
ROOT := github.com/zrepl/zrepl
@ -40,9 +40,24 @@ cover: artifacts
$(ARTIFACTDIR):
mkdir -p "$@"
release: $(ARTIFACTDIR) vet test docs
$(ARTIFACTDIR)/docs: $(ARTIFACTDIR)
mkdir -p "$@"
docs: $(ARTIFACTDIR)/docs
make -C docs \
html \
BUILDDIR=../artifacts/docs \
docs-clean:
make -C docs \
clean \
BUILDDIR=../artifacts/docs
release-bins: $(ARTIFACTDIR) vet test
GOOS=linux GOARCH=amd64 go build -o "$(ARTIFACTDIR)/zrepl-linux-amd64"
GOOS=freebsd GOARCH=amd64 go build -o "$(ARTIFACTDIR)/zrepl-freebsd-amd64"
clean:
release: release-bins docs
clean: docs-clean
rm -rf "$(ARTIFACTDIR)"

View File

@ -41,6 +41,6 @@ step "Fetching dependencies using 'dep ensure'"
dep ensure
step "Making release"
make release
make release-bins
step "Release artifacts are available in $(pwd)/artifacts"

View File

@ -10,11 +10,11 @@ BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" -c sphinxconf $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -c sphinxconf $(SPHINXOPTS) $(O)

View File

@ -23,7 +23,7 @@ if [ ! -d "$PUBLICDIR" ]; then
exit 1
fi
echo -n "PRESS ENTER to confirm you commited the docs changes to the zrepl repo"
echo -n "PRESS ENTER to confirm you commited and pushed docs changes and tags to the zrepl repo"
read
pushd "$PUBLICDIR"
@ -47,9 +47,12 @@ popd
echo "building site"
set -e
make clean
make html
rsync -a _build/html/ public_git/
sphinx-versioning build \
--show-banner \
docs ./public_git \
-- -c sphinxconf # older conf.py throw errors because they used
# version = subprocess.show_output(["git", "describe"])
# which fails when building with sphinxcontrib-versioning
set +e
CURRENT_COMMIT=$(git rev-parse HEAD)
@ -57,7 +60,7 @@ git status --porcelain
if [[ "$(git status --porcelain)" != "" ]]; then
CURRENT_COMMIT="${CURRENT_COMMIT}(dirty)"
fi
COMMIT_MSG="sphinx render from publish.sh - `date -u` - ${CURRENT_COMMIT}"
COMMIT_MSG="sphinx-versioning render from publish.sh - `date -u` - ${CURRENT_COMMIT}"
pushd "$PUBLICDIR"

View File

@ -36,7 +36,7 @@ extensions = ['sphinx.ext.todo',
'sphinx.ext.extlinks']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ['../_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
@ -57,10 +57,9 @@ author = 'Christian Schwarz'
# built documents.
#
# The short X.Y version.
import subprocess
version = subprocess.check_output(["git", "describe"]).decode("utf-8")
#version = set by sphinxcontrib-versioning
# The full version, including alpha/beta/rc tags.
release = version
#release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -97,10 +96,10 @@ html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ['../_static']
html_logo = '_static/zrepl.svg'
html_logo = '../_static/zrepl.svg'
# -- Options for HTMLHelp output ------------------------------------------