Skip to content

Commit

Permalink
Push documentation to different folders
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolfernandez committed May 3, 2016
1 parent d0a92af commit e4213c3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
36 changes: 15 additions & 21 deletions ci_scripts/push_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,39 @@
# The behavior of the script is controlled by environment variable defined
# in the circle.yml in the top level folder of the project.

MSG="Pushing the docs for revision for branch: $CIRCLE_BRANCH, commit $CIRCLE_SHA1"
if [ ! -z "$1" ]
then DOC_FOLDER=$1
fi

MSG="Pushing the docs for revision for branch: $CIRCLE_BRANCH, commit $CIRCLE_SHA1, folder: $DOC_FOLDER"

cd $HOME
# Copy the build docs to a temporary folder
rm -rf tmp
mkdir tmp
cp -R $HOME/$DOC_REPO/doc/build/html/* ./tmp/

# Clone the docs repo if it isnt already there
if [ ! -d $DOC_REPO ];
then git clone "[email protected]:$USERNAME/"$DOC_REPO".git";
fi

# Copy the build docs to a temporary folder
rm -rf tmp
mkdir tmp
cp -R $HOME/$DOC_REPO/doc/build/html/* ./tmp/

cd $DOC_REPO
git branch gh-pages
git checkout -f gh-pages
git reset --hard origin/gh-pages
git clean -dfx

for name in $(ls -A $HOME/$DOC_REPO); do
case $name in
.nojekyll) # So that github does not build this as a Jekyll website.
;;
circle.yml) # Config so that build gh-pages branch.
;;
*)
git rm -rf $name
;;
esac
done
git rm -rf $HOME/$DOC_REPO/$DOC_FOLDER && rm -rf $HOME/$DOC_REPO/$DOC_FOLDER

# Copy the new build docs
mkdir $DOC_URL
cp -R $HOME/tmp/* ./$DOC_URL/
mkdir $DOC_FOLDER
cp -R $HOME/tmp/* ./$DOC_FOLDER/

git config --global user.email $EMAIL
git config --global user.name $USERNAME
git add -f ./$DOC_URL/
git add -f ./$DOC_FOLDER/
git commit -m "$MSG"
git push -f origin gh-pages

echo $MSG
echo $MSG
9 changes: 7 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ test:
override:
- cat ~/log.txt && if grep -q "Traceback (most recent call last):" ~/log.txt; then false; else true; fi
deployment:
push:
master:
branch: master
commands:
- bash ci_scripts/push_doc.sh 'stable'
development:
branch: development
commands:
- bash ci_scripts/push_doc.sh
- bash ci_scripts/push_doc.sh 'dev'
general:
# Open the doc to the API
artifacts:
Expand All @@ -57,3 +61,4 @@ general:
branches:
only:
- development
- master

0 comments on commit e4213c3

Please sign in to comment.