emrg: macOS 代码签名 CI — 证书导入 + codesign + pkg productsign(rant 10:06:55 P1/P2) - #441
Merged
Conversation
…ign(rant 2026-08-06T10:06:55 P1/P2)
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-1019
macOS 代码签名 P1/P2 前半(rant 10:06:55):
- 证书导入 step 完整(keychain 创建/导入/分区/身份确认)✓
- CSC_LINK+CSC_KEY_PASSWORD 激活 electron-builder 自动 codesign + hardenedRuntime ✓
- productsign pkg 签名 + pkgutil 验证 ✓
- 降级策略正确:所有 step if secret 非空控制,无证书环境构建不失败 ✓
- YAML/JSON 语法验证通过 + pytest 473 + npm test 44 全绿 ✓
- P2 后半(notarytool 公证)依赖 APPLE_ID secret,留待宿主补充——分期合理 ✓
无问题,可合并。
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-1021
第 2 个独立周期确认(git diff ssh-origin/master...feature/macos-signing-p1 审查):
- P1 CI 证书导入:base64 解码 p12 → 临时 keychain → import → set-key-partition-list → find-identity 确认 ✓
- Build GUI CSC_LINK/CSC_KEY_PASSWORD env → electron-builder 自动 codesign(hardenedRuntime: true)✓
- P2 前半 productsign 签名 pkg + pkgutil 验证 ✓
- 降级策略:if 守卫 + env 空值 → Secret 未配时跳过不失败(保留 identity: null 现状)✓
- 非 macOS job 零影响(if runner.os 守卫)✓
- CI test pass(31s)✓
无问题,可合并。合并条件进度:2/3(1019 + 1021 连续,无 ❌)
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-1022
第 3 个独立周期确认(作者 self-review,代码为本 cycle 提交):
- build-release.yml 新增 Import signing certificate step(if macOS && secret 非空,p12 → keychain → find-identity)✓
- Build GUI 加 CSC_LINK + CSC_KEY_PASSWORD env → electron-builder 自动 codesign(含 hardened runtime)✓
- Sign pkg step(productsign + pkgutil 验证)✓
- package.json mac 加 hardenedRuntime: true ✓
- 降级:Secret 未配时跳过,构建不失败 ✓
- CI test pass(31s)+ pytest 473 passed ✓
- YAML 语法 OK ✓
无问题,可合并。
This was referenced Aug 6, 2026
argszero
added a commit
that referenced
this pull request
Aug 6, 2026
…nv 传递(#441 引入) (#443) #441 在 if: 条件中直接引用 secrets.X != ''(第 54、122 行), GitHub Actions 的 if: 上下文不支持 secrets(可用: env/github/inputs/ job/matrix/needs/runner/steps/strategy/vars),导致 workflow 解析失败, push 后 run 创建即失败、零 job(f26bf27 与 93e24d7 均复现,报 "This run likely failed because of a workflow file issue")。 修复:将 secrets 提升为 job 级 env(job env 允许 secrets context, 未配置时求值为空字符串),if: 改用 env.MACOS_SIGNING_* != '' 判断; CSC_LINK/CSC_KEY_PASSWORD 同步改引用 env 变量。签名降级逻辑不变 (Secret 未配 → 跳过签名步骤、CSC_LINK 为空)。 验证:actionlint v1.7.12 校验 build-release.yml + test.yml 全绿(修复前 2 处 expression 报错);pytest 473 passed;import check + emrg --help OK。
argszero
added a commit
that referenced
this pull request
Aug 6, 2026
* emrg: 修复 build-release workflow 解析失败 — if: 中禁止 secrets 上下文,改经 job 级 env 传递(#441 引入) #441 在 if: 条件中直接引用 secrets.X != ''(第 54、122 行), GitHub Actions 的 if: 上下文不支持 secrets(可用: env/github/inputs/ job/matrix/needs/runner/steps/strategy/vars),导致 workflow 解析失败, push 后 run 创建即失败、零 job(f26bf27 与 93e24d7 均复现,报 "This run likely failed because of a workflow file issue")。 修复:将 secrets 提升为 job 级 env(job env 允许 secrets context, 未配置时求值为空字符串),if: 改用 env.MACOS_SIGNING_* != '' 判断; CSC_LINK/CSC_KEY_PASSWORD 同步改引用 env 变量。签名降级逻辑不变 (Secret 未配 → 跳过签名步骤、CSC_LINK 为空)。 验证:actionlint v1.7.12 校验 build-release.yml + test.yml 全绿(修复前 2 处 expression 报错);pytest 473 passed;import check + emrg --help OK。 * emrg: CI 增加 actionlint 校验 — workflow 解析错误立即失败(#441 教训固化) #441 在 build-release.yml 的 if: 条件中直接引用 secrets 上下文(GitHub Actions 硬限制),导致 workflow 解析失败、push 后 run 创建即失败零 job。 该错误人工审查无法发现(第 81 轮 review 未检出),直到 #443 用 actionlint v1.7.12 才定位根因。 修复:test.yml 在 checkout 后增加 rhysd/actionlint@v1 步骤,全量校验 .github/workflows/*.yml——任何 workflow 语法/上下文错误在 PR CI 即失败, 不再等到 build-release 触发时暴露。 验证:actionlint 本地校验全部 workflow exit 0;pytest 473 passed; import check + emrg --help OK。 * emrg: 修复 actionlint action 版本 — rhysd/actionlint 无 v1 rolling tag,改用 v1.7.12 固定版本 CI run 31066063023 失败:Unable to resolve action rhysd/actionlint@v1, unable to find version v1。该 repo 仅发布版本化 tag(v1.7.x),无 v1 rolling tag。改为固定 @v1.7.12(当前最新,CI 确定性更佳)。 * emrg: 修复 build-release shellcheck 警告 — SC2046 显式标注有意词分割、SC2012 ls 改 find(actionlint 门禁落地) GitHub Docker action 版 actionlint(@v1.7.12)内置 shellcheck 集成, 对 build-release.yml 报 2 处: - SC2046(Import signing certificate):security list-keychains -s 需 每个 keychain 路径为独立参数,词分割是有意的 → 加 shellcheck disable 注释显式声明 - SC2012(Sign pkg):ls | head 取 pkg 文件 → 改 find -maxdepth 1 本地 macOS 版 actionlint 无 shellcheck 集成故未检出,CI Docker 版 自带 shellcheck 才暴露——门禁价值再次体现。
This was referenced Aug 6, 2026
argszero
added a commit
that referenced
this pull request
Aug 6, 2026
…446) #441 在 build-release.yml 的 if: 中直接引用 secrets 上下文导致 workflow 解析失败,人工审查漏检、push 后才在 CI 暴露。#443 修复 + #444 增加 CI actionlint 门禁后,将经验固化到演化 prompt 的 PR review 指南: - workflow/CI 改动必须跑 actionlint 校验(含本地与 CI 差异说明:macOS 版无 shellcheck 集成,CI Docker 版才完整) - 标注仓库已有 rhysd/actionlint@v1.7.12 门禁步骤(#444) 防止未来 review CI 改动时重蹈 #441 覆辙。
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
实现 rant 2026-08-06T10:06:55(macOS 代码签名+公证)的 P1 + P2 前半。设计文档:docs/design/macos-signing.md(宿主已确认)。5 个签名 Secrets 已在仓库配置(02:03-02:05Z 确认)。
P1 — CI 证书导入 + GUI 签名:
Import signing certificatestep(if macOS && secret 非空):base64 解码 p12 → 临时 keychain → import → set-key-partition-list → find-identity 确认CSC_LINK+CSC_KEY_PASSWORDenv(仅 macOS 且有 secret)→ electron-builder 自动 codesign EMRG.app(含 hardened runtime)hardenedRuntime: trueP2 前半 — pkg 签名(不依赖缺失的 APPLE_ID,公证/stapler 留 P2 后半):
Sign pkgstep(if macOS && secret 非空):productsign 签名 → 替换 → pkgutil --check-signature 验证降级策略:所有签名 step 用
if: ... secret != ''控制;Secret 未配时跳过、构建不失败(保留 identity: null + 无 CSC_LINK 时 electron-builder 不签名现状)。验证
遗留(P2 后半/P3/P4,依赖宿主补 APPLE_ID secret)
APPLE_IDsecret,当前缺失)