-
Notifications
You must be signed in to change notification settings - Fork 15
90 lines (79 loc) · 2.74 KB
/
Copy pathbuild-docs.yml
File metadata and controls
90 lines (79 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# The documentation site. Built on every change to it, and deployed to GitHub Pages from
# main -- so a pull request finds out that a link is dead without anything being published.
#
# The GIFs under docs/public/demo are committed rather than rendered here: rendering one
# wants a container with a coding agent CLI stand-in in it. See docs/tapes/README.md.
name: docs
on:
push:
branches: [main]
paths:
- .github/workflows/build-docs.yml
- docs/**
pull_request:
paths:
- .github/workflows/build-docs.yml
- docs/**
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# A superseded pull request build is worth cancelling. A push to main is not: this group
# holds `deploy` too, and a run cancelled while `deploy-pages` is publishing leaves Pages
# with a deployment that never finished, which is a site that 404s until something else is
# pushed. Two pushes to main a minute apart is all that takes.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
# `lastUpdated` reads each page's last commit, and a shallow clone has none.
fetch-depth: 0
- uses: pnpm/action-setup@v6
with:
version: 10
- uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm
cache-dependency-path: docs/pnpm-lock.yaml
- name: Install
working-directory: docs
run: pnpm install --frozen-lockfile
# Fails on a dead internal link, which is the point: a page moved without its inbound
# links moving is a red build rather than a 404 somebody finds later.
- name: Build
working-directory: docs
run: pnpm build
# VitePress checks that a link's page exists and stops there, so a `#fragment` written
# the way GitHub would slugify it passes the build and silently drops the reader at the
# top of the page. This is what catches that.
- name: Every #fragment resolves
working-directory: docs
run: pnpm check:anchors
- uses: actions/upload-pages-artifact@v5
with:
path: docs/.vitepress/dist
deploy:
name: deploy
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
group: pages
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- uses: actions/deploy-pages@v5
id: deployment