Created
March 3, 2020 19:46
-
-
Save linhai86/290ac8e77505232eb729d7a6cf1d7587 to your computer and use it in GitHub Desktop.
This file contains 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 -e | |
remote_repo="" | |
gp_branch="gh-pages" | |
publish_dir="_build/html" | |
# Build Sphinx doc | |
echo "Build documentation." | |
rm -rf ${publish_dir} | |
make html | |
# Create orphan gh-pages branch | |
echo "Create gh-pages branch." | |
cd "${publish_dir}" | |
git init | |
git checkout --orphan "${gp_branch}" | |
git remote add origin "${remote_repo}" | |
# Add and commit content | |
echo "Commit." | |
git add --all | |
commit_message="Automated deployment: $(date -u)" | |
git commit --allow-empty -m "${commit_message}" | |
# Publish to GitHub Pages | |
echo "Publish." | |
git push origin --force "${gp_branch}" | |
echo "GitHub Pages is successfully deployed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment