Skip to content

fix(distribution): regenerate the site download manifest on every deploy - #113

Merged
bitdan merged 1 commit into
masterfrom
fix/site-downloads-sync
Nov 27, 2026
Merged

bitdan merged 1 commit into
masterfrom
fix/site-downloads-sync

Conversation

@bitdan

@bitdan bitdan commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Important

合并前先把仓库 Settings → Pages 的来源从 “Deploy from a branch” 改为 “GitHub Actions”。
先合并的话,传统构建读不到已移除的 docs/_data/downloads.json,会上线一份空的 install/downloads.tsv;安装脚本现在优先读它,而 tap 的副本目前还是 404,终端安装会直接失败。先切换没有风险:线上官网保持现状,直到本工作流首次部署。

问题

终端安装脚本的备用清单 install/downloads.tsv 由手动提交的 docs/_data/downloads.json 渲染,distribute.yml 只更新 tap 仓库的副本。发新版后,官网这份会一直指向 0.3.2:仍能安装,但版本是旧的,也没有任何提示。

改动

  • scripts/site-downloads.mjs:读取 releases/latest 接口数据,用 GitHub 为每个附件记录的 SHA-256 生成 docs/_data/downloads.json。生成规则沿用 distribution.mjs 的 downloadManifest,格式与 tap 一致。附件不全、缺少 SHA-256,或者是草稿/测试版时报错。
  • .github/workflows/pages.yml:官网改由 Actions 构建部署(jekyll-build-pages,与传统模式相同的 github-pages 环境)。
    • docs/ 或生成脚本有改动推送到 master 时部署;PR 中只构建,不部署。
    • Release 工作流结束后,通过 workflow_run 重新部署(测试版标签跳过)。github-pages 环境只允许从 master 部署,打标签触发的流水线不能直接部署;workflow_run 总在默认分支上运行。
    • 上传前检查渲染出的 TSV 包含全部附件;生成或检查失败时,线上保留上一次部署。
  • docs/_data/downloads.json:从仓库移除,并加入 .gitignore。
  • 安装脚本:改为先读官网清单、失败时改读 tap 副本。官网清单现在随发版更新;raw.githubusercontent.com 在部分网络下不可达,而且 tap 在下次发版前没有 downloads.tsv,原来每次安装都会先失败一次。
  • TECHNICAL.md、docs/_config.yml 说明同步更新,新测试加入 npm test。

验证

  • npm test 40 项通过。
  • 用线上最新 Release 实际生成清单,与原来提交的 0.3.2 文件逐字节一致。
  • 用线上 TSV 试跑部署前的行数检查:5 行,与附件数一致。
  • 本 PR 会触发 Pages 工作流的构建任务(不部署),验证清单生成与 Jekyll 构建。

合并后

  • 推送到 master 会触发首次 Actions 部署;之后核对 https://bitdan.github.io/snap-desk/install/downloads.tsv、install.ps1.txt、install.sh 均正常返回。
  • 下次正式版发布后,确认 Pages 工作流由 workflow_run 触发,并更新到新版本。

🤖 Generated with Claude Code

docs/_data/downloads.json was committed by hand and the release pipeline
only refreshed the copy in the tap repository, so the terminal
installers' site fallback would keep installing 0.3.2 after the next
release.

Build and deploy the site from GitHub Actions instead of the legacy
branch build. Before the Jekyll build, scripts/site-downloads.mjs reads
the latest stable release and writes the manifest from the SHA-256
digests GitHub records for each asset. The workflow redeploys after the
Release workflow finishes (workflow_run runs on master, which the
github-pages environment requires) and checks that the rendered TSV
lists every asset before publishing.

The installers now read the site manifest first and fall back to the
tap copy, since raw.githubusercontent.com is unreachable on some
networks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bitdan
bitdan merged commit 1481323 into master Nov 27, 2026
10 of 12 checks passed
@bitdan
bitdan deleted the fix/site-downloads-sync branch November 27, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant