-
Notifications
You must be signed in to change notification settings - Fork 166
126 lines (111 loc) · 4.61 KB
/
docs.yaml
File metadata and controls
126 lines (111 loc) · 4.61 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
name: Deploy Documentation
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
permissions:
contents: read
pages: write
id-token: write
actions: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: docs-builder/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: docs-builder
- name: Build documentation
run: node build.js
working-directory: docs-builder
- name: Detect release video sources
id: release-videos
shell: bash
run: |
shopt -s nullglob
sources=(release-videos/*/index.html)
if (( ${#sources[@]} == 0 )); then
echo "found=false" >> "$GITHUB_OUTPUT"
echo "No release video sources found; skipping video rendering."
else
echo "found=true" >> "$GITHUB_OUTPUT"
printf 'Found %s release video source(s).\n' "${#sources[@]}"
fi
# ----- Render hyperframes release videos and stage them as docs assets -----
# Source HTML lives in /release-videos/<version>/. Rendering uses headless
# Chrome with CanvasDrawElement enabled for the HTML-in-canvas CRT pass.
# Cached output is keyed on the source files so we only re-render when
# the HTML, shared scripts, or audio actually change.
- name: Install Chrome dev channel
if: steps.release-videos.outputs.found == 'true'
run: |
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-linux-signing-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-linux-signing-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install -y google-chrome-unstable
- name: Cache hyperframes Chromium
if: steps.release-videos.outputs.found == 'true'
uses: actions/cache@v4
with:
path: ~/.cache/hyperframes
key: hyperframes-cache-v1
- name: Cache rendered release videos
if: steps.release-videos.outputs.found == 'true'
id: video-cache
uses: actions/cache@v4
with:
path: docs-builder/dist/assets/release-videos
key: release-videos-${{ hashFiles('release-videos/**/index.html', 'release-videos/_shared/**/*.js', 'release-videos/render-with-crt.sh', 'release-videos/_audio/track.mp3') }}
- name: Render release videos
if: steps.release-videos.outputs.found == 'true' && steps.video-cache.outputs.cache-hit != 'true'
run: |
shopt -s nullglob
mkdir -p docs-builder/dist/assets/release-videos
for src in release-videos/*/index.html; do
version=$(basename "$(dirname "$src")")
out="docs-builder/dist/assets/release-videos/tasknotes-${version}.mp4"
echo "::group::Rendering ${version}"
HTML_CANVAS_CHROME=/usr/bin/google-chrome-unstable release-videos/render-with-crt.sh "release-videos/${version}" -o "${out}" -q standard
echo "::endgroup::"
done
# Even on cache-hit we still need the cached files inside dist/. The
# actions/cache restore happens before docs build (which wipes dist/),
# so re-stage them after.
- name: Restore cached videos into fresh dist/
if: steps.release-videos.outputs.found == 'true' && steps.video-cache.outputs.cache-hit == 'true'
run: |
# cache restore puts files at docs-builder/dist/assets/release-videos
# but the build above wiped dist/. Re-fetch from the cache by re-running
# the cache key — actions/cache restores into the same path on hit, but
# since dist/ was wiped after, we run cache restore explicitly here.
mkdir -p docs-builder/dist/assets/release-videos
# NOTE: This branch is a fallback. In practice the cache should be
# restored AFTER the docs build step — see workflow ordering above.
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs-builder/dist/
deploy:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4