Last active
August 29, 2015 14:13
-
-
Save oz123/ee56e7a38abf5d75eb64 to your computer and use it in GitHub Desktop.
Build sphinx docs from multiple branches on change - kind of like read the docs for the poor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CONFIG_FILE=$1 | |
source $CONFIG_FILE | |
cd $PROJECT_DIR | |
export PATH=/usr/local/bin:$PATH | |
BRANCHES=($BRANCHES) | |
PACKAGES=($PACKAGES) | |
function ffw(){ | |
git checkout $1 | |
git rebase "origin/$1" | |
} | |
function build_docs(){ | |
cd docs | |
make html | |
if [ $? -eq 0 ]; then | |
echo "Make html finished with 0" | |
echo -n $CURRENT > ../CURRENT_"$b" | |
cp -R build/html/ $DESTINATION/$b | |
cp ../CURRENT_$b $DESTINATION/$b | |
fi | |
cd .. | |
} | |
git fetch --all | |
for (( i= 0; i < ${#BRANCHES[@]}; i++)) do | |
echo ${BRANCHES[$i]} ${PACKAGES[$i]} | |
b=${BRANCHES[$i]} | |
ffw ${BRANCHES[$i]} | |
CURRENT=`git log --oneline -1 | cut -d " " -f 1` | |
LATEST=`cat CURRENT_"$b"` | |
if [ ${CURRENT} == ${LATEST} ]; then | |
echo "Skipping build of "$b"..." | |
else | |
build_docs | |
fi | |
done | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT_DIR=/home/user/project | |
BRANCHES="master develop branch1" | |
PACKAGES="Package1 Package2 Package2" | |
DESTINATION=/home/www/www-build | |
VENV=/home/user/venv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment