Clark Boylan 4a50d176c2 Make run-docs.sh handle stable branch changes.
Previously run-docs.sh uploaded everything but tagged releases to
the root of the developer/project document dir. If changes were uploaded
to master then stable/foo the latest docs would get overwritten by the
stable/foo docs. This change will put master docs in developer/project
and stable foo docs in developer/project/foo fixing this issue.

Change-Id: Ia6d33c5b1654fd6b937154a425a3ea6cdc1d7f27
2012-07-24 14:21:32 -07:00

40 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -xe
# If a bundle file is present, call tox with the jenkins version of
# the test environment so it is used. Otherwise, use the normal
# (non-bundle) test environment. Also, run pip freeze on the
# resulting environment at the end so that we have a record of exactly
# what packages we ended up testing.
#
venv=venv
mkdir -p doc/build
export HUDSON_PUBLISH_DOCS=1
tox -e$venv -- python setup.py build_sphinx
result=$?
if `echo $GERRIT_REFNAME | grep refs/tags/ >/dev/null` ; then
TAG=`echo $GERRIT_REFNAME | sed 's/refs.tags.//'`
if [ ! -z $TAG ] ; then
# Move the docs into a subdir if this is a tagged build
mkdir doc/build/$TAG
mv doc/build/html/* doc/build/$TAG
mv doc/build/$TAG doc/build/html/$TAG
fi
elif `echo $GERRIT_REFNAME | grep stable/ >/dev/null` ; then
BRANCH=`echo $GERRIT_REFNAME | sed 's/stable.//'`
if [ ! -z $BRANCH ] ; then
# Move the docs into a subdir if this is a stable branch build
mkdir doc/build/$BRANCH
mv doc/build/html/* doc/build/$BRANCH
mv doc/build/$BRANCH doc/build/html/$BRANCH
fi
fi
echo "Begin pip freeze output from test virtualenv:"
echo "======================================================================"
.tox/$venv/bin/pip freeze
echo "======================================================================"
exit $result