-
Notifications
You must be signed in to change notification settings - Fork 309
186 lines (167 loc) · 6.76 KB
/
Copy pathfrontstage-pages.yml
File metadata and controls
186 lines (167 loc) · 6.76 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
name: Frontstage Pages
on:
workflow_dispatch:
schedule:
- cron: "37 */6 * * *"
pull_request:
paths:
- ".github/workflows/frontstage-pages.yml"
- "README.md"
- "README.zh-CN.md"
- "apps/presentation/dashboard/**"
- "apps/presentation/site/**"
- "docs/**"
- "mkdocs.yaml"
- "docs/showcases/**"
- "docs/assets/long-running-loop-openviking-trajectory.png"
- "docs/assets/long-running-loop-ml-experiment-trajectory.png"
- "examples/export-frontstage-share-bundle.mjs"
- "examples/frontstage-share-bundle-smoke.mjs"
- "examples/readme-star-history-smoke.py"
- "examples/goal-channel-frontstage-fixture.py"
- "examples/showcase-catalog-smoke.py"
- "examples/status.example.json"
- "scripts/render-star-history.py"
- "scripts/install-from-github.sh"
push:
branches:
- main
paths:
- ".github/workflows/frontstage-pages.yml"
- "README.md"
- "README.zh-CN.md"
- "apps/presentation/dashboard/**"
- "apps/presentation/site/**"
- "docs/**"
- "mkdocs.yaml"
- "docs/showcases/**"
- "docs/assets/long-running-loop-openviking-trajectory.png"
- "docs/assets/long-running-loop-ml-experiment-trajectory.png"
- "examples/export-frontstage-share-bundle.mjs"
- "examples/frontstage-share-bundle-smoke.mjs"
- "examples/readme-star-history-smoke.py"
- "examples/goal-channel-frontstage-fixture.py"
- "examples/showcase-catalog-smoke.py"
- "examples/status.example.json"
- "scripts/render-star-history.py"
- "scripts/install-from-github.sh"
permissions:
actions: read
contents: read
pages: write
id-token: write
concurrency:
group: frontstage-pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: "20"
cache: npm
cache-dependency-path: apps/presentation/dashboard/package-lock.json
- name: Use stable npm
run: npm install -g npm@11
- name: Install dashboard dependencies
working-directory: apps/presentation/dashboard
run: npm ci --include=dev --no-audit --no-fund --registry=https://registry.npmjs.org
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install docs dependencies
run: python -m pip install --disable-pip-version-check -r docs/requirements-docs.txt
- name: Validate public showcase catalog
run: python3 examples/showcase-catalog-smoke.py
- name: Validate README star history
run: python3 examples/readme-star-history-smoke.py
- name: Validate public-safe frontstage bundle
working-directory: apps/presentation/dashboard
run: npm run smoke:frontstage-share-bundle
- name: Export Pages frontstage artifact
working-directory: apps/presentation/dashboard
run: npm run export:frontstage-share -- --base /loopx/ --out-dir ../../../output/frontstage-pages
- name: Fetch complete GitHub stargazer history
if: github.event_name != 'pull_request'
env:
# Since July 2026, GitHub restricts this endpoint to repository
# collaborators. Keep this credential read-only and repo-scoped.
GH_TOKEN: ${{ secrets.STAR_HISTORY_READ_TOKEN }}
run: |
set -euo pipefail
if [[ -z "${GH_TOKEN:-}" ]]; then
echo "::error title=Missing star-history credential::Set STAR_HISTORY_READ_TOKEN to a fine-grained PAT limited to this repository with Metadata: read." >&2
exit 1
fi
owner="${GITHUB_REPOSITORY%%/*}"
repo="${GITHUB_REPOSITORY#*/}"
count_query='query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) { stargazerCount }
}'
history_query='query($owner: String!, $repo: String!, $endCursor: String) {
repository(owner: $owner, name: $repo) {
stargazers(first: 100, after: $endCursor, orderBy: {field: STARRED_AT, direction: ASC}) {
edges { starredAt }
pageInfo { hasNextPage endCursor }
}
}
}'
for attempt in 1 2 3; do
count_before="$(gh api graphql -f query="$count_query" -F owner="$owner" -F repo="$repo" --jq .data.repository.stargazerCount)"
gh api graphql --paginate --slurp \
-f query="$history_query" \
-F owner="$owner" \
-F repo="$repo" \
> "$RUNNER_TEMP/loopx-stargazer-pages.json"
jq '[.[].data.repository.stargazers.edges[] | {starred_at: .starredAt}]' \
"$RUNNER_TEMP/loopx-stargazer-pages.json" \
> "$RUNNER_TEMP/loopx-stargazers.json"
count_after="$(gh api graphql -f query="$count_query" -F owner="$owner" -F repo="$repo" --jq .data.repository.stargazerCount)"
fetched_count="$(jq 'length' "$RUNNER_TEMP/loopx-stargazers.json")"
if [[ "$count_before" == "$count_after" && "$fetched_count" == "$count_after" ]]; then
printf '%s\n' "$count_after" > "$RUNNER_TEMP/loopx-stargazers-count"
break
fi
if [[ "$attempt" == 3 ]]; then
echo "stargazer snapshot changed or was incomplete: before=$count_before fetched=$fetched_count after=$count_after" >&2
exit 1
fi
sleep 5
done
- name: Generate verified public star history
if: github.event_name != 'pull_request'
run: |
python3 scripts/render-star-history.py \
--repo "$GITHUB_REPOSITORY" \
--input-json "$RUNNER_TEMP/loopx-stargazers.json" \
--expected-count "$(cat "$RUNNER_TEMP/loopx-stargazers-count")" \
--output output/frontstage-pages/site/site-assets/star-history.svg
- name: Build documentation site
run: mkdocs build --strict --site-dir output/frontstage-pages/site/docs
- name: Configure Pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v6
with:
enablement: true
- name: Upload Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v5
with:
path: output/frontstage-pages/site
deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to Pages
id: deployment
uses: actions/deploy-pages@v5