-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (212 loc) · 6.27 KB
/
docs.yml
File metadata and controls
212 lines (212 loc) · 6.27 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# DO NOT EDIT - This file is generated by cigen
# Source: .cigen/workflows/
# Regenerate with: cargo run -- --config .cigen generate
#
on:
push:
branches:
- main
paths:
- docs/**
- .github/workflows/docs.yml
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
name: DOCS
jobs:
build:
runs-on: ubuntu-latest
container:
image: rust:latest
needs:
- ci_gate
steps:
- name: Prepare Node runtime for actions
if: ${{ env.ACT == 'true' }}
run: |
set -e
if ! command -v node >/dev/null 2>&1 || ! command -v protoc >/dev/null 2>&1; then
apt-get update
apt-get install -y nodejs npm protobuf-compiler
fi
- name: Install protobuf compiler
if: runner.os == 'Linux'
run: |
set -e
if command -v sudo >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y protobuf-compiler
else
apt-get update
apt-get install -y protobuf-compiler
fi
- name: Checkout repository
uses: actions/checkout@v4
- name: Download cigen binary
uses: actions/download-artifact@v4
with:
name: cigen-bin
path: .cigen/bin
continue-on-error: true
- name: Ensure cigen binary
run: |
set -e
if [ ! -x .cigen/bin/cigen ]; then
echo 'cigen binary not found; building from source'
cargo build --release --bin cigen
mkdir -p .cigen/bin
cp target/release/cigen .cigen/bin/cigen
fi
- name: Prepare cigen binary
run: |
set -e
mkdir -p .cigen/bin
chmod +x .cigen/bin/cigen
- name: Compute source hash
id: compute_hash
run: |
set -euo pipefail
mkdir -p .cigen/skip-cache
mkdir -p .cigen/cache
./.cigen/bin/cigen hash \
--job build \
--config .cigen \
--base-dir . \
--output job_hash \
--cache .cigen/cache/file-hashes.json
- name: Restore skip cache
id: job_skip_cache
uses: actions/cache@v4
with:
path: .cigen/skip-cache/build
key: job-skip-${ runner.os }-build-${ steps.compute_hash.outputs.job_hash }
restore-keys: job-skip-${ runner.os }-build-
if: ${{ env.ACT != 'true' }}
- name: Skip job (cached)
if: steps.job_skip_cache.outputs.cache-hit == 'true'
run: echo 'Job cache hit; skipping remaining steps.' && exit 0
- uses: actions/setup-node@v4
with:
node-version: '20'
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- uses: pnpm/action-setup@v4
with:
version: 10
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- name: Install root deps (if any)
run: |
pnpm install --frozen-lockfile || pnpm install
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- name: Build docs (if present)
run: |
set -e
if [ -f docs/package.json ]; then
cd docs
pnpm install --frozen-lockfile || pnpm install
if pnpm run -s build; then
echo "Docs built with pnpm"
elif npm run build; then
echo "Docs built with npm"
else
echo "Docs build script not found" >&2
exit 1
fi
if [ ! -d dist ]; then
echo "Docs build output not found at dist/" >&2
exit 1
fi
else
echo "docs/package.json not found; docs site missing" >&2
exit 1
fi
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- name: Verify docs output exists
run: |
if [ ! -d docs/dist ]; then
echo "Docs build output not found at docs/dist" >&2
exit 1
fi
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- uses: actions/configure-pages@v5
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- uses: actions/upload-pages-artifact@v3
with:
path: docs/dist
if: steps.job_skip_cache.outputs.cache-hit != 'true'
- name: Record job completion
if: success() && steps.job_skip_cache.outputs.cache-hit != 'true'
run: |
set -e
HASH="${JOB_HASH}"
if [ -z "$HASH" ]; then
echo 'JOB_HASH missing' >&2
exit 1
fi
MARKER=.cigen/skip-cache/build/$HASH
mkdir -p "$(dirname "$MARKER")"
date > "$MARKER"
env:
JOB_HASH: ${{ steps.compute_hash.outputs.job_hash }}
ci_gate:
runs-on: ubuntu-latest
steps:
- name: Prepare Node runtime for actions
if: ${{ env.ACT == 'true' }}
run: |
set -e
if ! command -v node >/dev/null 2>&1 || ! command -v protoc >/dev/null 2>&1; then
apt-get update
apt-get install -y nodejs npm protobuf-compiler
fi
- name: Install protobuf compiler
if: runner.os == 'Linux'
run: |
set -e
if command -v sudo >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y protobuf-compiler
else
apt-get update
apt-get install -y protobuf-compiler
fi
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
script: |-
const wait = require('./.github/wait-for-checks.js');
await wait({ github, context, core, checks: ["test"] });
deploy:
runs-on: ubuntu-latest
needs:
- build
env:
url: https://docspring.github.io/cigen/
name: github-pages
steps:
- name: Prepare Node runtime for actions
if: ${{ env.ACT == 'true' }}
run: |
set -e
if ! command -v node >/dev/null 2>&1 || ! command -v protoc >/dev/null 2>&1; then
apt-get update
apt-get install -y nodejs npm protobuf-compiler
fi
- name: Install protobuf compiler
if: runner.os == 'Linux'
run: |
set -e
if command -v sudo >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y protobuf-compiler
else
apt-get update
apt-get install -y protobuf-compiler
fi
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/deploy-pages@v4