Sync docs with readme (#428) #246
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: Docs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
permissions: | |
contents: write | |
jobs: | |
build-docs: | |
# When running on a PR, this just checks we can build the docs without errors | |
# When running on merge to main, it builds the docs and then another job deploys them | |
name: ${{ github.event_name == 'pull_request' && 'Check Build Docs' || 'Build Docs' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install pandoc | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: pandoc | |
version: 1.0 | |
- name: Install dependencies | |
run: poetry install --with docs | |
- name: Build Docs | |
run: poetry run build-docs | |
- name: Upload Docs Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: documentation | |
path: docs/build | |
deploy-docs: | |
name: Deploy Docs | |
runs-on: ubuntu-latest | |
# Only run if merging a PR into main | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: build-docs | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download Docs Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: documentation | |
path: docs/build | |
- name: Upload to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: docs/build | |
clean-exclude: | | |
*.*.*/ |