.github/workflows/docs.yml
name: Docs CI
on:
push:
pull_request:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: "true"
- name: Install Doxygen
run: sudo apt install -y doxygen graphviz
shell: bash
- name: Generate Doxygen Documentation
run: docs/doxygen.sh
shell: bash
- name: Build Docs
run: pip install ./python[dev] && sphinx-build -ET docs/ docs/build/html/
- name: Sanitize ref name for docs version
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV
- name: Move to versioned directory
run: mv docs/build/html .github/pages/$DOCS_VERSION
- name: Write switcher.json
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json
- name: Publish Docs to gh-pages
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .github/pages
keep_files: true