Bump actions/checkout from 3 to 4 (#518) #193
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: Update gh-pages documentation for main branch | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
env: | |
PYTHONUNBUFFERED: 1 | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the main branch | |
uses: actions/checkout@v4 | |
# We need a full clone rather than a shallow clone so that setuptools-scm | |
# can compute the right version number for the docs. | |
# xref: https://github.com/pypa/setuptools_scm/issues/431 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install graphviz | |
run: | | |
sudo apt-get update | |
sudo apt-get install graphviz | |
- name: Install dependencies and local packages | |
run: | | |
python -m pip install -r docs/requirements.txt | |
python -m pip install . | |
- name: Build HTML documentation with Sphinx | |
run: | | |
cd docs | |
python -m sphinx -b html -d doctrees source build | |
- name: Configure Git | |
run: | | |
git config user.name "Documentation Bot" | |
git config user.email "<>" | |
- name: Update gh-pages branch | |
run: | | |
git fetch --depth=1 origin gh-pages | |
git checkout gh-pages | |
rm -r dev | |
mv docs/build dev | |
git add dev | |
# Only commit if there are changes | |
git diff-index --quiet --cached HEAD || git commit -m "Automated update of main branch documentation" | |
git push origin gh-pages |