1name: Docs site23on:4 push:5 branches: [main]6 pull_request:7 branches: [main]8 paths:9 - "docs/**"10 - "website/**"11 - "package/**"12 - "tools/api_docs.ts"13 - "tools/site_llms.ts"14 - "tools/node_docs.ts"15 - "tools/entrypoints.ts"16 - "deno.json"17 - ".github/workflows/site.yml"1819permissions:20 contents: read2122# The /node section renders from a PINNED lofi-node checkout so site builds are23# reproducible; content changes there ride an explicit bump of this ref.24# Bump procedure: point LOFI_NODE_REF at the new lofi-node commit SHA in the25# same PR that reviews the resulting /node pages.26env:27 LOFI_NODE_REF: 9bc3319fe30d747921f27206ba6d5a5193f298942829jobs:30 build:31 runs-on: ubuntu-latest32 env:33 LOFI_NODE_DIR: lofi-node-checkout34 steps:35 - uses: actions/checkout@v436 - uses: actions/checkout@v437 with:38 repository: FelineStateMachine/lofi-node39 ref: ${{ env.LOFI_NODE_REF }}40 path: lofi-node-checkout41 - uses: denoland/setup-deno@v242 with:43 deno-version: v2.x44 - uses: actions/setup-node@v445 with:46 node-version: 2247 cache: npm48 cache-dependency-path: website/package-lock.json49 - name: Generate API references, /node docs, and llms.txt pairs50 run: deno task site:gen51 - name: Install site dependencies52 run: npm ci --prefix website53 - name: Build site (fails on broken links)54 run: npm run build --prefix website55 - name: Upload site build56 if: github.event_name == 'push'57 uses: actions/upload-artifact@v458 with:59 name: site-build60 path: website/build61 retention-days: 16263 deploy:64 if: github.event_name == 'push'65 needs: build66 runs-on: ubuntu-latest67 # the Cloudflare credentials live as secrets on the `dev` environment; a job68 # must declare that environment for them to resolve69 environment:70 name: dev71 url: https://lofi.host72 steps:73 - name: Download site build74 uses: actions/download-artifact@v475 with:76 name: site-build77 path: site-build78 # wrangler runs via npx (npm cache) rather than wrangler-action: the action79 # installs wrangler with `npm i` into the checkout, and npm cannot graft80 # onto the Deno-managed node_modules layout at the repo root.81 - name: Deploy to Cloudflare Pages82 env:83 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}84 CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}85 run: |86 if ! npx --yes wrangler@4 pages project list | grep -q "lofi-host"; then87 npx --yes wrangler@4 pages project create lofi-host --production-branch=main88 fi89 npx --yes wrangler@4 pages deploy site-build --project-name=lofi-host --branch=main