Created
March 22, 2015 01:32
-
-
Save surhudm/54675a6103bc2780f0c1 to your computer and use it in GitHub Desktop.
Serve sphinx documentation for git repository on gh-pages
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 | |
: ' | |
This gist describes how to serve sphinx documentation | |
for a code already existing on git using gh-pages | |
' | |
: ' | |
First install pip | |
' | |
pip install --upgrade sphinx | |
: ' | |
Git clone the project | |
' | |
git clone [email protected]:username/project.git | |
cd project | |
: ' | |
Generate documentation | |
' | |
mkdir docs | |
cd docs | |
sphinx-quickstart | |
: ' | |
Make sure to separate the build and source directories and to generate a Makefile | |
Configure source/conf.py to your liking, edit the theme. Also edit the index.rst file to include your docs. | |
' | |
mkdir -p build/html | |
: ' | |
Clone your repository in build/html, and reinitialize it to be bare | |
' | |
git clone [email protected]:username/project.git build/html | |
cd build/html | |
git symbolic-ref HEAD refs/heads/gh-pages | |
rm .git/index | |
git clean -fdx | |
touch .nojkeyll | |
cd ../.. | |
make html | |
cd build/html | |
git add . | |
git commit -m 'Documents to gh-pages' | |
git push origin gh-pages | |
: ' | |
Change your code, push to the master branch on the repository. | |
Then change directory to docs, make html | |
Go to the html build and push the documents with a simple git push | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment