Skip to content

Commit 8daff70

Browse files
nunocoracaoclaude
andcommitted
fix: use @electron/osx-sign and @electron/notarize for universal app
electron-builder --prepackaged skips signing entirely. Using @electron/osx-sign to properly sign all nested frameworks/helpers with correct entitlements, then @electron/notarize before packaging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a5a165a commit 8daff70

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,51 @@ jobs:
212212
}).then(() => console.log('Universal merge complete'))
213213
.catch(err => { console.error('Universal merge failed:', err.message); process.exit(1); });
214214
"
215-
# Build DMG and zip from the universal app — electron-builder handles signing + notarization
216-
# (CSC_IDENTITY_AUTO_DISCOVERY is NOT set here so electron-builder picks up the certificate)
217-
npx electron-builder --config electron-builder.yml --publish never --prepackaged dist/mac-universal/Watchfire.app
215+
# Sign the universal app using @electron/osx-sign (handles nested frameworks/helpers properly)
216+
# and notarize using @electron/notarize, then package into DMG/zip without re-signing
217+
node -e "
218+
const path = require('path');
219+
const appPath = path.join(process.cwd(), 'dist/mac-universal/Watchfire.app');
220+
221+
async function run() {
222+
// Sign with @electron/osx-sign (signs all nested components with correct entitlements)
223+
const identity = process.env.CODESIGN_IDENTITY;
224+
if (identity) {
225+
const { signApp } = require('@electron/osx-sign');
226+
console.log('Signing universal app with Developer ID...');
227+
await signApp({
228+
app: appPath,
229+
identity: identity,
230+
optionsForFile: (filePath) => ({
231+
hardenedRuntime: true,
232+
entitlements: path.join(process.cwd(), 'entitlements.mac.plist'),
233+
'entitlements-inherit': path.join(process.cwd(), 'entitlements.mac.plist'),
234+
timestamp: true,
235+
}),
236+
});
237+
console.log('Code signing complete.');
238+
} else {
239+
console.log('No CODESIGN_IDENTITY — skipping signing.');
240+
}
241+
242+
// Notarize
243+
const appleId = process.env.APPLE_ID;
244+
if (appleId && identity) {
245+
const { notarize } = require('@electron/notarize');
246+
console.log('Submitting for notarization...');
247+
await notarize({
248+
appPath: appPath,
249+
appleId: appleId,
250+
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
251+
teamId: process.env.APPLE_TEAM_ID,
252+
});
253+
console.log('Notarization complete.');
254+
}
255+
}
256+
run().catch(err => { console.error(err); process.exit(1); });
257+
"
258+
# Build DMG and zip from the already-signed universal app (skip signing + notarization)
259+
CSC_IDENTITY_AUTO_DISCOVERY=false npx electron-builder --config electron-builder.yml --publish never --prepackaged dist/mac-universal/Watchfire.app -c.mac.notarize=false
218260
219261
- name: Upload DMG
220262
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)