add: try/except diagram and other fun things #219
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 & Publish Lessons | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build-book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install dependencies | |
run: python3 -m pip install nox | |
- name: Build book | |
run: nox -s docs-test | |
# Save html as artifact for CircleCI viewing | |
- name: Save book html as artifact for viewing | |
uses: actions/upload-artifact@v4 | |
# Run even if the docs-test step fails, but not if we cancel | |
if: ${{ ! cancelled() }} | |
with: | |
name: book-html | |
path: | | |
_build/html/ | |
- name: Upload gh pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
path: _build/html | |
# Test for bad links and ensure alt tags for usability | |
- name: Check HTML using htmlproofer | |
uses: chabad360/htmlproofer@master | |
with: | |
directory: "_build/html" | |
arguments: | | |
--ignore-files "/.+\/_static\/.+/,/genindex.html/" | |
--ignore-status-codes "404, 403, 429, 503" | |
continue-on-error: true | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-book | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |