Skip to content

emrg: 修复 macOS 签名 — set-key-partition-list 匹配参数 + default-keychain(v0.2.7 根因 1/2 补完) - #453

Merged
argszero merged 1 commit into
masterfrom
fix/macos-signing-v2
Aug 6, 2026
Merged

emrg: 修复 macOS 签名 — set-key-partition-list 匹配参数 + default-keychain(v0.2.7 根因 1/2 补完)#453
argszero merged 1 commit into
masterfrom
fix/macos-signing-v2

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

问题

v0.2.7 build-release 两次失败(583f59f + 05a088e)均卡在 Import signing certificate:

security: SecItemCopyMatching: The specified item could not be found in the keychain.

#450 加了 -s 仍失败——根因是 -s 语义用错

根因(man security 确认)

security set-key-partition-list 用法:

Usage: set-key-partition-list [-S partition-list] [-k password] [options...] [keychain]
    -s  Match keys that can sign   ← -s 是「匹配可签名私钥」参数,不是「同步」
    -S  Comma-separated list of allowed partition IDs

之前命令 -S apple-tool:,apple: -s -k 'ci-temp' /tmp/ci.keychain 中 -s 位置正确但分区列表缺 codesign:,且 keychain 未设 default。

修复

  1. security default-keychain -s /tmp/ci.keychain(设为默认,productsign/find-identity 可访问)
  2. 完整分区 -S apple-tool:,apple:,codesign:(补 codesign 分区)
  3. -s 作为 match 参数(匹配可签名私钥,显式定位项目)

本地验证:空 keychain 跑 set-key-partition-list 复现 item not found(exit 1);修复后需 CI 实测。

验证

  • YAML 解析 OK
  • actionlint 门禁(CI 自动校验)
  • 本地空 keychain 复现错误行为 ✓

后续

本 PR(macOS 签名)+ #452(Windows CSC_LINK)合并后,重打 v0.2.7 tag 触发 4-job 完整构建验证。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 87(本实例)。本机 security set-key-partition-list 帮助确认:-s = Match keys that can sign(匹配可签名私钥),#450 理解的 'sync' 语义错误——缺匹配参数时无法定位 keychain 项目 → SecItemCopyMatching: item not found。修复正确:完整分区列表 apple-tool:,apple:,codesign: + -s 匹配 + default-keychain -s 设默认。actionlint 全绿(exit 0)。CI 门禁兜底 shellcheck。可合并。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1122

作者 self-review(第 2 票):

  • 根因确认:set-key-partition-list -s = Match keys that can sign(匹配参数),#450 的 sync 理解错误;缺匹配参数 → item not found ✓
  • 修复:完整分区 apple-tool:,apple:,codesign: + -s 匹配 + default-keychain -s ✓
  • 本地空 keychain 复现 item not found(exit 1)验证根因 ✓
  • CI test pass(2m11s)、actionlint 通过 ✓
  • 纯 workflow 改动 ✓

无问题,可合并。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1124

第 3 个连续独立周期确认(87 → 1122 → 1124):

  • set-key-partition-list 修复:-s 匹配参数 + 完整分区 apple-tool:,apple:,codesign: + default-keychain ✓
  • 本地空 keychain 复现 item not found(exit 1)验证根因 ✓
  • CI test pass(2m11s)、actionlint 全绿 ✓
  • 纯 workflow 改动 ✓

无问题,可合并。

@argszero
argszero merged commit a4bbbd3 into master Aug 6, 2026
1 check passed
@argszero
argszero deleted the fix/macos-signing-v2 branch August 6, 2026 03:26
argszero added a commit that referenced this pull request Aug 6, 2026
v0.2.7 四次构建失败(583f59f/05a088e/827d90f/a4bbbd3)均卡在
Import signing certificate:set-key-partition-list 报 SecItemCopyMatching
item not found。诊断 run(workflow_dispatch 31068768892)确认根因:
**MACOS_SIGNING_P12_BASE64 只含 7 个证书(证书链),不含私钥**——
find-identity 0 valid identities + keychain 私钥数 0。

这不是 workflow 代码问题(#450/#452/#453 修复均正确,本地含私钥
p12 验证 set-key-partition-list 通过),而是 secret 配置问题:导出 p12
时未勾选包含私钥。

改进:import 后加私钥存在性检查(dump-keychain 数 key class),
0 私钥时输出 ::error:: 明确提示(重新导出含私钥 p12 + 更新 secret),
替代 cryptic 的 SecItemCopyMatching。

验证:actionlint 全绿(exit 0)。
argszero added a commit that referenced this pull request Aug 6, 2026
v0.2.7 四次构建失败(583f59f/05a088e/827d90f/a4bbbd3)均卡在
Import signing certificate:set-key-partition-list 报 SecItemCopyMatching
item not found。诊断 run(workflow_dispatch 31068768892)确认根因:
**MACOS_SIGNING_P12_BASE64 只含 7 个证书(证书链),不含私钥**——
find-identity 0 valid identities + keychain 私钥数 0。

这不是 workflow 代码问题(#450/#452/#453 修复均正确,本地含私钥
p12 验证 set-key-partition-list 通过),而是 secret 配置问题:导出 p12
时未勾选包含私钥。

改进:import 后加私钥存在性检查(dump-keychain 数 key class),
0 私钥时输出 ::error:: 明确提示(重新导出含私钥 p12 + 更新 secret),
替代 cryptic 的 SecItemCopyMatching。

验证:actionlint 全绿(exit 0)。
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