Continuous Integration

There are two separate steps in continuous integration. The first step is building your book, and the second is deploying your book.

GitHub Actions and Pages

Use the following CI file:

# The name of your workflow. Always specify the name!
name: Build Docs

# Events that would trigger your workflow
on:
  # In this case we would like to build the documentation
  # whenever new commits are pushed to the `main` branch
  push:
    branches: [main]
  # Or, if you want to manually trigger the workflow,
  # use `workflow_dispatch`
  workflow_dispatch:

# necessary permissions required for deploying the document
permissions:
  contents: read
  pages: write
  id-token: write

# What jobs would be involved in building the document
jobs:
  # Job 1: build the docs
  build-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: DeterminateSystems/nix-installer-action@v20
      - uses: DeterminateSystems/magic-nix-cache-action@v13

      - name: Build docs
        run: nix develop .#default --command typst c ./doc.typ --features bundle,html -f bundle ./dist

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./dist/otter-docs
  # Job 2: deploy the docs
  deploy:
    needs: build-docs
    runs-on: ubuntu-latest
    environment:
      name: github-pages
    steps:
      - uses: actions/deploy-pages@v5