#!/usr/bin/env bash # switch branches and make sure we've got the latest version git checkout gh-pages git pull origin gh-pages # go to master for the latest docs from master git checkout master git pull origin master # build the docs make clean make html cd .. # switch back to gh-pages git checkout gh-pages # delete everything non-relevant and extract docs ls | grep -v docs | xargs rm -r touch .nojekyll mv ./docs/build/html/* ./ rm -rf ./docs # And commit to publish git add -A git commit -m "publishing updated docs..." git push origin gh-pages # switch back to master git checkout master # go back to docs dir cd docs