feat: 增加 Linux 打包与 GitHub 构建发布链
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
新增 build-linux.js,直接从官方 zip 转写 tar 保住可执行位, Windows 上也能构建 Linux 包。新增 build-release.js 作为发布件 唯一出口,排除便携版 data/、回读产物校验内容、生成校验和。 GitHub Actions 分测试、四目标打包、标签发布三段。
This commit is contained in:
@@ -135,8 +135,10 @@ npx electron src/_test/electron/<name>.integration.js # Electron 集成
|
||||
## 构建
|
||||
|
||||
```bash
|
||||
npm run build # Windows,输出 dist/PeopleLib-windows-x64/
|
||||
npm run build:mac # macOS arm64,输出 .app 与 .dmg,只能在 macOS 上跑
|
||||
npm run build # Windows,输出 dist/PeopleLib-windows-x64/
|
||||
npm run build:mac # macOS arm64,输出 .app 与 .dmg,只能在 macOS 上跑
|
||||
npm run build:linux -- --arch x64 # Linux,输出 tar.gz,任意平台可构建
|
||||
npm run release -- --platform linux --arch x64 # 发布件 + 校验和
|
||||
```
|
||||
|
||||
Windows:
|
||||
@@ -155,12 +157,31 @@ macOS(`build-mac.js`,易踩坑):
|
||||
- 数据目录走 `~/Library/Application Support/PeopleLib`,**不要**沿用 Windows 的便携布局:`.app` 在 DMG 里只读,且升级覆盖会删掉用户书库。
|
||||
- `.icns` 由 `npm run icons:icns` 生成,纯 Node 实现(icns 自 10.7 起内嵌 PNG),不依赖 macOS 的 `iconutil`。窗口图标在非 Windows 平台用 PNG,`.ico` 只有 Windows 认。
|
||||
|
||||
Linux(`build-linux.js`):
|
||||
|
||||
- 直接从官方 zip 的条目转写进 tar,**不落地中间目录**。可执行位存在 zip 的 external attributes 里,先解到 NTFS 再打包会全部丢掉,产物解压后主程序和 `chrome-sandbox` 都不可执行。因此这个脚本在 Windows 上也能构建。
|
||||
- tar 头是手写的。路径超过 100 字节要走 PAX 扩展头:ustar 的 `prefix` 只能在斜杠处切分,`undici` 与 vendor 里的深层路径切不出合法组合。
|
||||
|
||||
发布件(`build-release.js`):
|
||||
|
||||
- 发布件的唯一出口,不要手工压缩构建目录上传。Windows 便携版的 `data/` 就在程序同级,手工压缩会把用户书库连同笔记打进公开发布件;脚本按前缀排除并在打包后回读压缩包确认。
|
||||
- 打完包一定回读产物再签校验和:Linux 要确认可执行位还在,Windows 要确认没有 `data/` 与 `_test`。只算哈希不看内容,等于把「构建脚本改坏了」这类问题一路放到用户手上。
|
||||
|
||||
## 持续集成
|
||||
|
||||
- `.github/workflows/build.yml`:`validate`(单测 + 全部集成套件,`xvfb-run` 起 X server)→ `package`(四目标矩阵)→ `release`(仅 `v*` 标签)。
|
||||
- 仓库 `.npmrc` 指向 npmmirror,GitHub runner 在境外拉不动,工作流用 `npm_config_registry` 与 `ELECTRON_MIRROR` 覆盖回官方源。新增构建步骤时别把这两个环境变量漏掉。
|
||||
- 新增集成套件后要同步加进工作流的套件列表,单测里有断言按 `src/_test/electron/` 的实际文件逐个核对,漏加会直接失败。
|
||||
- 标签名必须等于 `v` + `package.json` 的 `version`,且标签要指向被构建的那个提交。
|
||||
|
||||
## 仓库
|
||||
|
||||
两个远端,用途不同:
|
||||
|
||||
- `github`(公开):**只放 README 与截图**,不推源码、不推 `BUILD.md`。历史与本地无共同祖先,用独立的 orphan/docs 提交推送。
|
||||
- `origin`(私有):完整源码。
|
||||
- `origin`(私有):完整源码,日常开发推这里。
|
||||
- `github`(公开):源码与 CI。GitHub Actions 必须 checkout 到源码才能构建,所以公开仓不再只放 README。历史与本地无共同祖先,推送前先核对两边的差异范围。
|
||||
|
||||
推公开仓前必须确认:没有本地配置、账号凭据、`data/` 内容或诊断产物混进去。公开仓一旦推出去,删提交也留在别人的克隆里。
|
||||
|
||||
其他:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user