beads/.github/workflows/deploy-docs.yml
matt wilkie e3a3bb9bdc
fix(ci): resolve lychee baseUrl mismatch with symlink-based root directory (#3105)
The previous --remap approach didn't work because lychee resolves file://
URIs directly against the filesystem, ignoring remaps.

Instead, create a wrapper directory with a symlink:
  website/link-check-root/beads → website/build

This makes --root-dir website/link-check-root resolve /beads/foo to
website/link-check-root/beads/foo → website/build/foo correctly.

The symlink is outside website/build, so it doesn't affect the Pages
artifact upload.

Amp-Thread-ID: https://ampcode.com/threads/T-019d68c4-3efa-71bf-aa9d-6e25fc48fb9a

Co-authored-by: Amp <amp@ampcode.com>
2026-04-07 12:21:40 -07:00

102 lines
2.6 KiB
YAML

name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'website/**'
- 'scripts/generate-llms-full.sh'
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: website
run: npm ci
- name: Generate llms-full.txt
run: ./scripts/generate-llms-full.sh
- name: Build website
working-directory: website
run: npm run build
- name: Prepare link check (map baseUrl /beads/ to build output)
run: |
mkdir -p website/link-check-root
ln -s "$PWD/website/build" website/link-check-root/beads
- name: Check internal links
uses: lycheeverse/lychee-action@v2
with:
args: |
--verbose
--no-progress
--offline
--include-fragments
--timeout 30
--root-dir website/link-check-root
--exclude-path 'website/build/search/**'
website/build
fail: true
- name: Check external links (non-blocking)
uses: lycheeverse/lychee-action@v2
continue-on-error: true
with:
cache: true
args: |
--verbose
--no-progress
--timeout 30
--scheme https
--scheme http
--exclude 'localhost'
--exclude '127.0.0.1'
--exclude 'tree/main'
--exclude 'example.com'
--exclude 'mailto:'
--exclude-path 'website/build/search/**'
website/build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: website/build
deploy:
# Guard: deploy should only run in the canonical repository (not in forks)
if: ${{ github.repository == 'gastownhall/beads' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5