Skip to content

Commit 4cb162b

Browse files
ci(docs-deploy): print what each docs deploy uploads, by part, before the upload (#38297)
repo:objectstack#3 · os-tesla · session_01L9qibzZRa3nLMmeQvLoDWE <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao9y3zpvwyjTXecpSHhuy4Ag)_ Fixes #36192 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:文档站部署每次在上传前多打印一张表,列出这次要传多少、各部分各占多少,写在部署日志和运行摘要里。 - 为什么做:文档站部署产物瘦身专题的第二步(第一步已合并,合并后第一次线上部署从 954.6 MB 降到 742.8 MB,少传约 22%),以后每次部署都有体积读数,变大能马上看见。 - 出错会怎样:这一步只读不写;它自己坏了只出一条警告,部署照常发布。撤回本 PR 即还原。 - 要你做的:这是部署流程文件的改动,需要你批准后才能合并。 ## What changes - `.github/workflows/docs-deploy.yml`: one new step, `Measure what this deploy uploads`, between the build assertion and the upload. It runs `node apps/docs/scripts/measure-deploy-output.mjs` (landed in #38264), prints the per-part table to the log and appends it to the run summary. - It runs before the upload so the reading exists for the runs that need it most: the ones whose upload aborts. - `continue-on-error: true`, the only step in this workflow with it: the step publishes nothing, so a broken measurement must not stop the docs from publishing. A failure still leaves a `::warning::` annotation. The workflow's header rule (a run that cannot deploy goes red) is about the publish, and it is unchanged. - `timeout-minutes: 5` on the same step: `continue-on-error` does not absorb a hang, so without it only the job's 30-minute clock would end the step, with no deploy. A step that hits its own timeout counts as failed, which `continue-on-error` lets through. The script is synchronous local reads and takes seconds. - The reading is written to `$RUNNER_TEMP`, outside the tree `vercel deploy --prebuilt` reads. - `skip-changeset`: a workflow file, nothing publishes. ## Tests - The step's `run:` block, extracted from the YAML and run locally with `RUNNER_TEMP` and `GITHUB_STEP_SUMMARY` set, against the offline `vercel build` output: exit 0; log and summary both carry the table (`Deployment files: 13039 … Distinct contents: 7847 files, 631.7 MiB`). - Same block with `.vercel/output` moved away: the script refuses (no `config.json`), the step prints the warning and exits 1, which `continue-on-error` turns into a warning on a green run. - The step's keys parsed from the YAML at `cd1513fc`: `name`, `continue-on-error: true`, `timeout-minutes: 5`, `run`. No check-run executes the step (Docs Deploy runs from `main` only); its first run is the first deploy after merge. ## Acceptance notes - What #36192 measured, for the card: production run 46118151955 uploaded 954.6 MB / 13,039 files before #38264. Offline, content-deduplicated: 742.8 MiB before, 631.7 MiB after #38264 (−15.0%). The first scheduled deploy after #38264 (run 46146191991) uploaded 742.8 MB / 13,039 files by the CLI's own lines (−22.2%), read on the card in 7239573592; the two scales are not reconciled. The claim (7237738388) replaced the card's "well under half" target with the measured reduction; the reader-visible remainder (function code 188.5 MiB, the compiled collection twice; the trimmed tree still ~48 KB per page) goes to the maintainer as a decision. ## Verification Read first: the new step in `.github/workflows/docs-deploy.yml`, above `Deploy the prebuilt output to production`. Two-minute check: after merge, the next Docs Deploy run (scheduled, or "Run workflow" on `main`) shows a `Docs deploy output` table in its summary and the deploy still reaches `Deployed:`. <details><summary>Gates at cd1513f</summary> - `node scripts/pm/dispatch-gates.mjs --commands`: 36 derived families, each run with its exit captured before any pipe, all exit 0 (one sweep under the verify lock, 896 s; list in the card's project files as `gates-ran-pr2-cd1513fc.list`); `--ran`: 36 derived, 36 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero). - `node scripts/pm/overlap-check.mjs`: VERDICT clean, merges cleanly into origin/main. - `dispatch-gates.mjs --tier .github/workflows/docs-deploy.yml`: no path-derived mandate. The path is a governed surface (Tier H): landing needs the maintainer's approval. - Every family CI runs: the PR's check-runs. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibzZRa3nLMmeQvLoDWE)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibzZRa3nLMmeQvLoDWE --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 333e6f3 commit 4cb162b

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎.github/workflows/docs-deploy.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,40 @@ jobs:
188188
fi
189189
echo "Built docs app: BUILD_ID=$(cat apps/docs/.next/BUILD_ID)"
190190
191+
# A reading, not a gate: what this deploy is about to upload, by part
192+
# (prerendered pages, function code, OG images, llms bodies, static
193+
# files), in this log and in the run summary. It runs BEFORE the upload
194+
# so the reading exists for exactly the runs that need it most, the ones
195+
# whose upload aborts. `.vercel/output` alone undercounts: the function
196+
# code rides in each function's `filePathMap` from the repository, which
197+
# the script adds; its header says how the file count reproduces the
198+
# CLI's own "Downloading N deployment files" line.
199+
#
200+
# `continue-on-error` on purpose, and the only step here that has it: a
201+
# broken measurement must never stop the docs from publishing (the header's
202+
# failure direction is about the PUBLISH going quietly stale; this step
203+
# publishes nothing). A failure still shows as a warning annotation.
204+
# `timeout-minutes` because `continue-on-error` does not absorb a hang:
205+
# without it only the job's clock would end the step, with no deploy. The
206+
# script is synchronous local reads (seconds); 5 minutes is the ceiling.
207+
- name: Measure what this deploy uploads
208+
continue-on-error: true
209+
timeout-minutes: 5
210+
run: |
211+
set -euo pipefail
212+
if ! node apps/docs/scripts/measure-deploy-output.mjs > "$RUNNER_TEMP/deploy-output-reading.txt"; then
213+
echo "::warning::measure-deploy-output.mjs failed; the deploy goes ahead without a size reading."
214+
exit 1
215+
fi
216+
cat "$RUNNER_TEMP/deploy-output-reading.txt"
217+
{
218+
echo "### Docs deploy output"
219+
echo
220+
echo '```text'
221+
cat "$RUNNER_TEMP/deploy-output-reading.txt"
222+
echo '```'
223+
} >> "$GITHUB_STEP_SUMMARY"
224+
191225
- name: Deploy the prebuilt output to production
192226
id: deploy
193227
env:

0 commit comments

Comments
 (0)