diff --git a/forge.config.ts b/forge.config.ts index ce2873c0..fbd9291c 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -39,6 +39,31 @@ const config: ForgeConfig = { }, rebuildConfig: {}, hooks: { + packageAfterCopy: + async (inConfig, buildPath, electronVersion, platform, arch) => { + try { + console.log('Build path:', buildPath); + + // Only run signing on macOS + if (platform === 'darwin') { + let output = await import('child_process').then(cp => cp.execSync(`cd ${buildPath} | find . -perm +111 -type f `)) + console.log('###',output.toString()); + const binaries = [...output]; + binaries.forEach(async (e) => + { + let outputSign = await import('child_process').then(cp => cp.execSync( + `codesign --deep --force --verbose --sign "${process.env.SIGN_ID}" "${e}"`, + { + stdio: 'inherit', + }, + )); + console.log("#######",outputSign); + }); + } + } catch (error) { + console.error(error) + } + }, postPackage: async (forgeConfig, packageResult) => { console.log('Post-package hook started'); console.log('Package result:', JSON.stringify(packageResult, null, 2));