The reason for this might be that some files like _static
and _sources
are missing from the directory that contains index.html
file. By default, Jekyll ignores directories starting with _
. Adding .nojekyll
will signal to GitHub Pages to not use Jekyll for building your site, and hence it will not ignore files like _static
and _sources
directories.
If you want to use sphinx-build
and copy the html files to another branch like gh-pages
, you can use a setup like below:
- name: Build Sphinx documentation
run: |
cd docs
sphinx-build . build
touch build/.nojekyll
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/
publish_branch: gh-pages
destination_dir: docs
In my case, I was missing the touch build/.nojekyll
part and thus the _static
and _sources
directories were missing.