Use modern website workflow with up to date sphinx version #84
Workflow file for this run
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: "Website update" | |
on: | |
push: | |
branches: | |
- "**" | |
- "!gh-pages" | |
- "!open-in-colab-rbnicsx" | |
workflow_dispatch: | |
jobs: | |
website: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone website repository on current branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Clone website repository on gh-pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
fetch-depth: 0 | |
path: _build/html | |
- name: Install dependencies | |
run: | | |
pip3 -q install sphinx-material sphinxcontrib-bibtex | |
- name: Generate sphinx website | |
run: | | |
rm -rf _build/html/* && python3 -m sphinx -W -b html . _build/html | |
- name: Fix permissions and add CNAME file | |
run: | | |
sudo chown $USER _build -R | |
echo "www.rbnicsproject.org" > _build/html/CNAME | |
- name: Deploy to GitHub pages | |
if: github.repository == 'RBniCS/rbnicsproject.org' && github.ref == 'refs/heads/main' | |
run: | | |
SHA_SHORT=$(git rev-parse --short HEAD) | |
pushd _build/html | |
git config user.name "GitHub Actions" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git pull origin gh-pages | |
[ -n "$(git status --porcelain=v1 2>/dev/null)" ] && git commit -m "deploy: ${SHA_SHORT}" | |
git push origin gh-pages | |
popd | |
shell: bash | |
- name: Deploy to GitHub artifacts | |
if: github.repository == 'RBniCS/rbnicsproject.org' && github.ref != 'refs/heads/main' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: website | |
path: _build/html | |
retention-days: 1 |