Build docs #6066
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
# Build and push the docs website | |
name: Build docs | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '0 */8 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.9] | |
steps: | |
- name: Use checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install requirements | |
run: | | |
python3 -m pip install -r docs/requirements.txt | |
- name: Render the docs | |
run: | | |
cd ./docs | |
make html | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: DocumentationHTML | |
path: docs/_build/html/ | |
if-no-files-found: error | |
- name: Commit documentation changes | |
run: | | |
tmp_folder=$(mktemp -d /tmp/tmp.XXXXXXXXXX) | |
cp -r docs/_build/html/* $tmp_folder/ | |
rm -rf *; rm -rf .github | |
git switch --orphan gh-pages | |
cp -r $tmp_folder/* . | |
touch .nojekyll | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Update documentation" -a || true | |
- name: Push changes | |
if: github.event_name == 'push' | |
uses: ad-m/github-push-action@master | |
with: | |
force: true | |
branch: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |