Skip to content

Lint the recent changes (#219) #117

Lint the recent changes (#219)

Lint the recent changes (#219) #117

Workflow file for this run

name: deploy-book
# Runs on main branch changes or manual dispatch
on:
workflow_dispatch:
push:
branches:
- main
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
# BUILD FIRST - Fail fast if there are build issues
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install Python dependencies
run: |
pip install -r requirements.txt
- name: Build the book
run: |
echo "Starting Jupyter Book build..."
jupyter-book build --all .
# Verify the build created the output directory and files
if [ ! -d "_build/html" ]; then
echo "❌ Error: Build failed to create _build/html directory"
exit 1
fi
if [ ! -f "_build/html/index.html" ]; then
echo "❌ Error: Build did not create index.html"
exit 1
fi
echo "✅ Build successful - _build/html created with $(find _build/html -name '*.html' | wc -l) HTML files"
# THEN run slower checks (lint, links, TOC)
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install npm dependencies
run: |
npm install
npm install -g markdownlint-cli
npm install -g markdown-link-check
- name: Lint markdown files
run: npm run lint
- name: Check markdown links
run: npm run links-ci
- name: Check TOC completeness
run: npm run check-toc
# Upload the book's HTML as an artifact
- name: Upload artifact
if: success()
uses: actions/upload-pages-artifact@v3
with:
path: "_build/html"
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
needs: build
steps:
# Deploy the book's HTML to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4