Deploy to GitHub Pages

Publish your GenGen site to GitHub Pages with Actions or manual pushes.

Deploy to GitHub Pages

GitHub Pages can serve the public/ directory generated by GenGen. Common approaches:

  1. GitHub Actions โ€“ use the official actions/deploy-pages workflow to build and publish on push.
  2. Manual publish โ€“ build locally with gengen build and push the public/ folder to the gh-pages branch.

Sample Workflow

name: Deploy
on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dart-lang/setup-dart@v1
      - run: dart pub get
      - run: gengen build docs
      - uses: actions/upload-pages-artifact@v2
        with:
          path: docs/public
  deploy:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: $
    steps:
      - uses: actions/deploy-pages@v2