@@ -118,7 +118,7 @@ exports.default = async function(context) {
118118 const helperPath = path . join ( helpersPath , helper ) ;
119119 if ( fs . statSync ( helperPath ) . isFile ( ) && ! helper . endsWith ( '.plist' ) ) {
120120 try {
121- // Don't use --options runtime for MAS builds (that's for Developer ID only)
121+ // Don't use --options runtime for MAS builds
122122 execSync ( `codesign --force --sign "${ identity } " --entitlements "${ entitlementsInherit } " "${ helperPath } "` , {
123123 stdio : 'inherit'
124124 } ) ;
@@ -172,10 +172,20 @@ exports.default = async function(context) {
172172 console . log ( '✅ Re-signed Electron Framework (bundle only)' ) ;
173173 }
174174
175+ // Check for provisioning profile to determine main app signing strategy
176+ const hasProvisioningProfile = fs . existsSync ( path . join ( appBundlePath , 'Contents' , 'embedded.provisionprofile' ) ) ;
177+
175178 // Sign main app bundle last (no --options runtime for MAS builds)
176- execSync ( `codesign --force --sign "${ identity } " --entitlements "${ entitlements } " "${ appBundlePath } "` , {
177- stdio : 'inherit'
178- } ) ;
179+ if ( hasProvisioningProfile ) {
180+ console . log ( 'Provisioning profile found. Signing WITHOUT --entitlements flag to avoid team-identifier error...' ) ;
181+ execSync ( `codesign --force --sign "${ identity } " "${ appBundlePath } "` , {
182+ stdio : 'inherit'
183+ } ) ;
184+ } else {
185+ execSync ( `codesign --force --sign "${ identity } " --entitlements "${ entitlements } " "${ appBundlePath } "` , {
186+ stdio : 'inherit'
187+ } ) ;
188+ }
179189 console . log ( '✅ App bundle re-signed successfully' ) ;
180190 } catch ( error ) {
181191 console . error ( '❌ Failed to re-sign app bundle:' , error . message ) ;
0 commit comments