name: Deploy Docs
on:
push:
branches: [main]
paths:
- 'docs/**'
# The twoslash showcase gallery is rendered from these at docs-build time
# (docs/scripts/build-twoslash-showcase.sh), so a fixture/renderer change
# must redeploy the docs too.
- 'libs/twoslash/**'
- 'package.json'
- 'package-lock.json'
pull_request:
branches: [main]
paths:
- 'docs/**'
# The twoslash showcase gallery is rendered from these at docs-build time
# (docs/scripts/build-twoslash-showcase.sh), so a fixture/renderer change
# must redeploy the docs too.
- 'libs/twoslash/**'
- 'package.json'
- 'package-lock.json'
workflow_dispatch:
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
# npm ci + the wasm nix build + VitePress build + Cloudflare deploy run ~5m.
timeout-minutes: 15
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v7
# `npm run docs:build` first runs `build:wasm`, which invokes
# `nix build .#table-wasm` to compile the drawTable playground module.
# Install Nix and wire up the binary cache so the ldc-wasm toolchain is
# pulled from the cache rather than built from source.
- name: Setup Nix
uses: ./.github/actions/setup-nix
with:
push-to-cache: true
cachix-cache: ${{ vars.CACHIX_CACHE }}
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
substituters: ${{ vars.SUBSTITUTERS }}
use-nix-cache: true
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
# Same headroom as the CI job's build — see the note there.
- name: Build VitePress site
env:
NODE_OPTIONS: --max-old-space-size=8192
run: npm run docs:build
# Shared with CircleCI — see ci/README.md. The script wraps the same two
# calls `cloudflare/wrangler-action` and `actions/github-script` made:
# `wrangler pages deploy`, then a marker-keyed upsert of the preview
# comment (so a re-run edits its own comment rather than appending).
- name: Deploy to Cloudflare Pages & comment the preview URL
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
GITHUB_TOKEN: ${{ github.token }}
run: ci/deploy-cloudflare-pages.sh