update contact and copyright #69
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
name: sphinx | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
env: | |
DEFAULT_BRANCH: "main" | |
#SPHINXOPTS: "-W --keep-going -T" | |
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings | |
jobs: | |
build-and-deploy: | |
name: Run sphinx and update GitHub pages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- uses: ammaraskar/sphinx-problem-matcher@master | |
- name: Build Sphinx docs | |
run: | | |
make dirhtml | |
# This fixes broken copy button icons, as explained in | |
# https://github.com/coderefinery/sphinx-lesson/issues/50 | |
# https://github.com/executablebooks/sphinx-copybutton/issues/110 | |
# This can be removed once these PRs are accepted (but the | |
# fixes also need to propagate to other themes): | |
# https://github.com/sphinx-doc/sphinx/pull/8524 | |
# https://github.com/readthedocs/sphinx_rtd_theme/pull/1025 | |
sed -i 's/url_root="#"/url_root=""/' _build/dirhtml/index.html || true | |
- name: Clone old gh-pages | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
set -x | |
git fetch | |
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages | |
rm -rf _gh-pages/.git/ | |
mkdir -p _gh-pages/branch/ | |
- name: Copy new build (default branch) | |
if: | | |
contains(github.event_name, 'push') && | |
contains(github.ref, env.DEFAULT_BRANCH) | |
run: | | |
set -x | |
# Delete everything under _gh-pages/ that is from the | |
# primary branch deployment. Eicludes the other branches | |
# _gh-pages/branch-* paths, and not including | |
# _gh-pages itself. | |
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete | |
rsync -a _build/dirhtml/ _gh-pages/ | |
- name: add .nojekyll file | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
touch _gh-pages/.nojekyll | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event_name == 'push' }} | |
#if: ${{ success() && github.event_name == 'push' && github.ref == 'refs/heads/$defaultBranch' }} | |
with: | |
publish_branch: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: _gh-pages/ | |
force_orphan: true | |