diff --git a/ci_scripts/push_doc.sh b/ci_scripts/push_doc.sh index 92595f80fe..3fa944b64a 100644 --- a/ci_scripts/push_doc.sh +++ b/ci_scripts/push_doc.sh @@ -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 \ No newline at end of file diff --git a/circle.yml b/circle.yml index 1d8d650b37..2ecd682cbd 100644 --- a/circle.yml +++ b/circle.yml @@ -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: @@ -57,3 +61,4 @@ general: branches: only: - development + - master