Last active
March 31, 2020 11:43
-
-
Save danmichaelo/9875056 to your computer and use it in GitHub Desktop.
Git post-commit: update api docs on gh-pages branch for GitHub Pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### | |
### The following block runs after commit to "master" branch | |
### | |
if [ `git rev-parse --abbrev-ref HEAD` == "master" ]; then | |
echo | |
echo "Updating API documentation at the gh-pages branch..." | |
echo | |
# Switch to gh-pages branch to sync it with master | |
################################################################### | |
git checkout gh-pages | |
# Checkout src directory from master | |
################################################################### | |
git checkout master -- src | |
# Re-generate API docs | |
################################################################### | |
php vendor/bin/sami.php update sami.config.php -v | |
# Add updated docs and commit | |
################################################################### | |
git add api_docs | |
git commit -m ":eyes: Update API docs after commit to master branch" | |
# Push | |
################################################################### | |
git push origin gh-pages | |
# Finally, switch back to the master branch and exit block | |
git checkout master | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment