Skip to content

Instantly share code, notes, and snippets.

@omrilotan
Last active January 13, 2019 20:56
Show Gist options
  • Save omrilotan/6df8ee479ff34711116e3257384255e7 to your computer and use it in GitHub Desktop.
Save omrilotan/6df8ee479ff34711116e3257384255e7 to your computer and use it in GitHub Desktop.
Autometed pushing of new versions of docs to gh-pages
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Continue only on 'master'
if [[ $CURRENT_BRANCH -ne 'master' ]]; then
exit;
fi
# Clone the branch and remove it's content
git clone -b gh-pages --single-branch https://github.com/<ORGENISATION>/<REPOSITORY>.git DOCS
rm -rf DOCS/*
echo "Building docs"
./node_modules/jsdoc/jsdoc.js lib/ -c .jsdocrc.json
# Push the new changes
cd DOCS
git add .
git commit -m "Updating the docs"
git push origin gh-pages
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment