Skip to content

ci(release): pre-import Apple cert before sidecar build#9

Merged
mrdulasolutions merged 1 commit into
mainfrom
claude/preimport-apple-cert
May 12, 2026
Merged

ci(release): pre-import Apple cert before sidecar build#9
mrdulasolutions merged 1 commit into
mainfrom
claude/preimport-apple-cert

Conversation

@mrdulasolutions
Copy link
Copy Markdown
Owner

Summary

Notarization rejected v0.1.8 with [Apple log](attached error) flagging exactly one file:

```json
{
"path": ".../runtime-modules/better-sqlite3/build/Release/better_sqlite3.node",
"message": "The binary is not signed with a valid Developer ID certificate."
},
{
"path": ".../runtime-modules/better-sqlite3/build/Release/better_sqlite3.node",
"message": "The signature does not include a secure timestamp."
}
```

That's the file `copy-runtime-modules.mjs` is supposed to sign — but my PR #7 patch made it best-effort, so when the runner's keychain didn't have the cert (which it doesn't, because tauri-action imports the cert later), the script logged a warning and kept going. Tauri-bundler's own codesign pass only walks `Contents/MacOS/`, never `Resources/`, so the .node stayed unsigned.

Fix

Add a new step right before "Build sidecar" that mirrors tauri-action's keychain dance but against the runner's default `login.keychain-db`:

  1. Decode `APPLE_CERTIFICATE` (base64 .p12) to a tmp file.
  2. `security import` it into `login.keychain-db` with `-T /usr/bin/codesign` so codesign can use it non-interactively.
  3. `security set-key-partition-list` to grant codesign access without a GUI prompt.
  4. `security find-identity -v -p codesigning` for visibility — should show "Developer ID Application: Matthew Dula (PPY9K2BYJH)".

Skips with an explanatory log when the secrets aren't set (unsigned-build path stays functional).

When tauri-action runs later it still creates its own keychain and imports the same cert there — codesign finds the identity in either, no conflict.

Test plan

  • CI green on this PR
  • After merge: dispatch v0.1.8 release one more time
  • arm64 build runs through: pre-import → sidecar build (now successfully signs .node with timestamp) → tauri-action codesign → notarytool accepts → AppleDouble gate passes
  • Draft release contains signed + notarized .dmg, .app.tar.gz, .sig, latest.json for both architectures
  • Locally verify with `codesign --verify --verbose=4` and `stapler validate`

🤖 Generated with Claude Code

Apple's notarytool rejected v0.1.8 with two errors against
Contents/Resources/runtime-modules/better-sqlite3/build/Release/
better_sqlite3.node:

  - "The binary is not signed with a valid Developer ID certificate."
  - "The signature does not include a secure timestamp."

Root cause: copy-runtime-modules.mjs codesigns the .node file as
part of `npm run runtime-modules`, but at that point in the
workflow the runner's keychain doesn't yet have the Apple
Developer ID cert — tauri-action only imports it later, inside its
own ephemeral keychain. PR #7's best-effort patch made the script
log a warning and continue when codesign failed, which kept the
build from aborting but left the .node unsigned. tauri-bundler's
own codesign pass walks Contents/MacOS/ only, not Resources/, so
the .node was still unsigned when notarytool inspected the .app.

Fix: a new step right before "Build sidecar" mirrors tauri-action's
keychain import dance, but against the runner's default
login.keychain-db. By the time runtime-modules runs codesign, the
identity is available with the secure-timestamp flag enabled, and
notarytool accepts the resulting .app.

Skipped (with explanatory log) when APPLE_CERTIFICATE secrets are
absent — keeps the unsigned-build path functional.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mrdulasolutions mrdulasolutions merged commit 9a85aab into main May 12, 2026
2 of 3 checks passed
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