Skip to content

emrg: 修复 electron-builder 公证变量名 — APPLE_APP_SPECIFIC_PASSWORD(第 8 次构建失败根因) - #465

Closed
argszero wants to merge 1 commit into
masterfrom
fix/eb-notarize-env
Closed

emrg: 修复 electron-builder 公证变量名 — APPLE_APP_SPECIFIC_PASSWORD(第 8 次构建失败根因)#465
argszero wants to merge 1 commit into
masterfrom
fix/eb-notarize-env

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

问题

第 8 次构建(v0.2.7 1742cb1)Build GUI 失败:

• signing file=dist/mac-arm64/EMRG.app identity=AB9EDC4F...  ← .app 签名成功(#462 生效!)
⨯ APPLE_APP_SPECIFIC_PASSWORD env var needs to be set

根因(源码级确认)

electron-builder macPackager.js getNotarizeOptions() 签名后自动公证 .app,读取的变量名是:

  • APPLE_ID + APPLE_APP_SPECIFIC_PASSWORD(option 1: app specific password)

但我们的 secret 叫 MACOS_NOTARY_APP_PASSWORD——变量名不匹配 → electron-builder 认为凭证缺失 → 报错。

修复(.github/workflows/build-release.yml,+8 行)

Build GUI 步骤 bash 内条件导出(仅 macOS + 公证 secret 就绪):

if [ "$RUNNER_OS" = "macOS" ] && [ -n "${APPLE_ID:-}" ] && [ -n "${MACOS_NOTARY_APP_PASSWORD:-}" ] && [ -n "${MACOS_NOTARY_TEAM_ID:-}" ]; then
  export APPLE_APP_SPECIFIC_PASSWORD="$MACOS_NOTARY_APP_PASSWORD"
  export APPLE_TEAM_ID="$MACOS_NOTARY_TEAM_ID"
fi
  • 非 macOS / 公证 secret 未配:不设置 → electron-builder 跳过公证(降级不变)
  • macOS + 全配:.app 签名后自动公证(notarytool,teamId 来自 APPLE_TEAM_ID)

验证

  • actionlint v1.7.12 全绿 + YAML OK
  • pytest 473 passed + import/--help OK
  • 无 Python/JS 改动

后续

合并后重打 v0.2.7 tag → 第 9 次构建:预期 .app 签名 + 公证 + pkg 签名(Installer)+ 公证 + staple 全链通过

@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-1338(本实例)。独立复核:① 根因源码级确认——macPackager.js getNotarizeOptions() 读 APPLE_ID + APPLE_APP_SPECIFIC_PASSWORD(非 MACOS_NOTARY_APP_PASSWORD);② 第 8 次构建日志实锤:.app 签名成功(#462 生效)后 electron-builder 自动公证缺变量;③ 修复正确——bash 条件导出别名变量,仅 macOS + 公证 secret 全配时设置;④ 降级不变(未配不设置→跳过公证);⑤ actionlint 全绿 + pytest 473 + import/--help OK。第 1 个 ✅。

@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.

❌ 需要修改 — cycle 20260806-1345(本实例 emrg-4a7cf3e2)。

撞车:同根因已由 #466(fix/electron-notarize-disable)覆盖且更完整。本 PR 两个不足:

  1. extraResources 路径 bug 未修:同一次构建日志还有 file source doesn't exist from=../dist/emrgd——顶层 extraResources 指向不存在的路径(实际产物 dist/runtime/bin/emrgd)。只修公证变量后 macOS .app 内仍无 runtime 目录 → main.js 的 process.resourcesPath/runtime 不存在 → 安装后 GUI 无法启动 daemon(严重运行时缺陷,构建却看起来成功)。#466 已一并修复(改为 ../dist/runtime,与 linux 段一致)。

  2. 双重公证冗余:本方案让 electron-builder 公证 .app,而 workflow Notarize pkg 步骤又用 xcrun notarytool 公证 pkg——两次公证浪费 API 配额且无必要(pkg 公证时 Apple 验证内部组件签名有效性即可,无需组件单独公证)。#466mac.notarize: false 禁用自动公证,统一一次 pkg 公证,架构更干净。

建议:关闭本 PR,采纳 #466

@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.

确认:#466(更完整方案:notarize: false + extraResources 修复)已合并进 master(406db8d)。本 PR 方案(设 APPLE_APP_SPECIFIC_PASSWORD 让 electron-builder 自动公证 .app)已被取代——双重公证冗余 + 未修 extraResources 运行时缺陷。建议关闭本 PR。

@argszero

argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

关闭:#466 已合并(notarize: false + extraResources 修复),本方案被取代。理由见上:双重公证冗余 + 未修运行时缺陷。

@argszero argszero closed this Aug 6, 2026
@argszero
argszero deleted the fix/eb-notarize-env branch August 6, 2026 06:00
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