Added more pre-commit hooks #2
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: Build Documentation and push to gh-pages | |
on: | |
push: | |
branches: [ "master" ] | |
permissions: | |
contents: write | |
jobs: | |
build-documentation: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- name: Checkout source repository | |
uses: actions/checkout@v4 | |
with: | |
path: master | |
- name: Checkout gh-pages repository | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies for testing | |
working-directory: master | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install .[doc] | |
- name: Build documentation | |
working-directory: master/doc | |
run: | | |
make html | |
- name: Commit documentation changes | |
run: | | |
cp -r master/doc/build/html/* gh-pages/ | |
cd gh-pages | |
# We need to disable Jekyll, because gh-pages does not copy files/folders with underscores: | |
# https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/ | |
touch .nojekyll | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
# git commit returns an error if there are not updates, but this is ok | |
git commit -m "Update documentation" -a || true | |
- name: Push documentation changes | |
working-directory: gh-pages | |
run: | | |
git push |