
Sphinx documentation on GitHub Pages
- Tutorial
GitHub Pages is such a cool schizophrenic thing that can a) display a page created using the built-in editor, b) generate a Jekyll blog and c) display html files on an arbitrary domain.
In the last image, she is interested in us for posting documentation written using Sphinx .
Technically, in any case, a branch is created
So, the project is one repository, the documentation for it is another, it makes no sense to mix them.
In
( link )
Procedure:
As a bonus seeing a bug where GitHub reports the number of the count ahead & behind , and when trying to compare reports that ... . Or should it be?
In the last image, she is interested in us for posting documentation written using Sphinx .
Technically, in any case, a branch is created
gh-pages
( except ) from which the content is displayed. So, the project is one repository, the documentation for it is another, it makes no sense to mix them.
In
master
the documentation repository, we store the sources in the ReStructuredText format and configuration files along with the change history. INgh-pages
not only is the story meaningless, but logically this branch also exists in parallel master
. I proceeded from such premises by creating the following script.#!/bin/sh
shopt -s extglob dotglob
CURR_DIR="$(pwd)"
TMP_DIR="$CURR_DIR"-gh-pages
sh build.sh
rm -rf "$TMP_DIR"
cp -r . "$TMP_DIR"
cd "$TMP_DIR"
git branch -D gh-pages
git checkout --orphan gh-pages
rm -rf !(.git|.gitignore)
cp -r "$CURR_DIR"/_build/html/* .
touch .nojekyll
echo "droidparts.org" > CNAME
git add -A
git commit -m "published"
git push origin :gh-pages
git push origin gh-pages
rm -rf "$TMP_DIR"
( link )
Procedure:
- Run the script that collects the documentation.
- Copy the repository to a temporary folder, go to it.
- Delete
gh-pages
, create it again. The parameter--orphan
is responsible for the fact that the branch will be created without a parent commit. Those. without reference tomaster
, as required. Also clear the folder. - We copy the files generated in the first step.
- We add
.nojekyll
so that GitHub Pages does not allow Jekyll to underline folders with underline. - We create a file
CNAME
with a domain from which everything will be given. Naturally, you also need to configure DNS . - Finally, commit, delete
gh-pages
from the server, do push.
As a bonus seeing a bug where GitHub reports the number of the count ahead & behind , and when trying to compare reports that ... . Or should it be?