# Example only: dormant and opt-in while this file is in site/docs/.
# The repository owner may copy it to .github/workflows/site.yml.
name: Pine site
on:
  workflow_dispatch:
    inputs:
      base_url:
        description: Final public HTTPS base URL, including the project path
        required: true
        default: https://johnlindquist.github.io/pine
        type: string
      lastmod:
        description: Actual content modification date (YYYY-MM-DD)
        required: true
        default: '2026-10-25'
        type: string
permissions:
  contents: read
concurrency:
  group: pine-pages
  cancel-in-progress: false
jobs:
  site:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.pages.outputs.page_url }}
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v7
        with:
          node-version: '22.19.0'
          package-manager-cache: false
      - name: Check site source and build behavior
        run: node --import ./test/isolate-env.mjs --test --test-concurrency=1 test/r3-landing/*.test.mjs test/r4-landing/*.test.mjs test/r5-agentic/*.test.mjs
      - name: Build site for this public URL
        env:
          PINE_SITE_BASE: ${{ inputs.base_url }}
          PINE_SITE_LASTMOD: ${{ inputs.lastmod }}
        run: node scripts/build-site.mjs --base-url "$PINE_SITE_BASE" --lastmod "$PINE_SITE_LASTMOD"
      - name: Check built files (HTTP remains unmeasured)
        run: node scripts/site-agent-check.mjs dist/site
      - uses: actions/configure-pages@v5
      - uses: actions/upload-pages-artifact@v4
        with:
          path: dist/site
      - uses: actions/deploy-pages@v4
        id: pages
