Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
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 "git@github.com:$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