name: deploy
on:
  push:
    tags:
      - v[0-9]+.[0-9]+.[0-9]+
concurrency:
  group: pages
  cancel-in-progress: true
jobs:
  build:
    runs-on: ubuntu-latest
    environment: github-pages
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v6
      - uses: DeterminateSystems/nix-installer-action@main
      - uses: DeterminateSystems/flakehub-cache-action@main
      - uses: pnpm/action-setup@v6
        with:
          version: latest
      - uses: actions/setup-node@v6
        with:
          node-version: "*"
          cache: pnpm
          cache-dependency-path: web/pnpm-lock.yaml
      - run: |
          cd web
          pnpm ci
          pnpm build
          touch build/.nojekyll
      - uses: actions/upload-pages-artifact@v5
        with:
          path: web/build
  deploy:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - id: deployment
        uses: actions/deploy-pages@v5
