Repository navigation
133 lines (121 loc) · 5 KB
/
Copy pathdocumentation.yml
File metadata and controls
133 lines (121 loc) · 5 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Documentation
# Deploys the full Docusaurus + Styleguidist site to gh-pages root.
# Triggers on push to BOTH `main` and `beta` so the new site can ship
# without waiting for a beta -> main release. `main` and `beta` push to
# the same gh-pages root; the most recent push wins (idempotent for
# identical sources, and Docusaurus is built fresh each time).
on:
push:
branches:
- main
- beta
pull_request:
branches:
- main
- beta
# Allow manual deploy from the Actions UI or `gh workflow run`. Useful
# when a previous run was cancelled by GitHub's pending-cancel logic.
workflow_dispatch:
# Serialize against same-workflow runs only. The previous version used a
# shared `gh-pages-deploy` group across documentation.yml +
# documentation-beta.yml + documentation-dev.yml — that turned out to be
# wrong: when multiple events queue simultaneously (e.g. a push event on
# the merge commit + a pull_request event for an open PR against beta),
# GitHub's "any previously pending job or workflow in the concurrency
# group will be cancelled" rule cancels the push run. Now each workflow
# only serializes with itself; the parallel beta+main+dev jobs may race
# the gh-pages branch but `peaceiris/actions-gh-pages@v3` with
# `keep_files: true` force-pushes, and the latest push wins.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
deploy:
name: Deploy Documentation
runs-on: ubuntu-latest
# Observed max 2.5 min over n=23 runs; 20 is a loose upper bound.
timeout-minutes: 20
# Only deploy on push, not on pull requests
if: github.event_name == 'push'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js 24
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install and build component styleguide
timeout-minutes: 10
run: |
# Generate the gitignored Ajv-compiled validator that the
# component sources import (src/utils/validateManifestV2.compiled.js).
# The styleguide build resolves it as a file on disk, so it must
# exist before the sub-build runs. build:validators needs root deps.
npm ci
npm run build:validators
cd styleguide
npm ci
npm run build
- name: Clear build cache and install dependencies
# 10m: covers `npm ci` (~1m) + `docusaurus build`
# for both en + nl locales (~6m together with cache cleared) +
# headroom. The previous 3m budget left no slack and started
# timing out as soon as the docusaurus dep tree grew, even when
# the build itself succeeded.
timeout-minutes: 10
run: |
cd docusaurus
rm -rf node_modules/.cache
rm -rf .docusaurus
rm -rf build
npm run ci
- name: Verify build output
run: |
cd docusaurus/build
if [ ! -f index.html ]; then
echo "ERROR: index.html not found in build directory!"
exit 1
fi
# The styleguide is NOT copied into docusaurus/build any more. It ships as
# its own scoped deploy below so that `keep_files: false` can replace the
# whole subtree. Copying it in here meant it inherited the root deploy's
# `keep_files: true`, which never deletes, so every build's
# content-hashed bundle.<hash>.js was kept forever.
- name: Create .nojekyll file
run: |
cd docusaurus/build
touch .nojekyll
# Root keeps `keep_files: true` on purpose: this deploy publishes to the
# branch root, and clearing it would delete /beta and /dev, which are
# written by their own workflows and would 404 until their next push.
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docusaurus/build
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
force_orphan: false
allow_empty_commit: true
keep_files: true
# Scoped to `styleguide/`, so `keep_files: false` replaces that subtree
# and nothing else. This is what stops the bundle accumulation: a
# superseded bundle.<hash>.js is gone the moment a new build lands.
- name: Deploy styleguide to /styleguide/ on GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./styleguide/build
publish_branch: gh-pages
destination_dir: styleguide
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
keep_files: false
- name: Verify deployment
run: |
git fetch origin gh-pages
echo "Deployment completed. Latest commit: $(git rev-parse origin/gh-pages)"