@@ -21,32 +21,39 @@ runs:
2121 # Certificate setup
2222 - name : Import Apple certificates
2323 if : inputs.os == 'macos'
24- uses : apple-actions/import-codesign-certs@v5
24+ uses : apple-actions/import-codesign-certs@v3
2525 with :
2626 p12-file-base64 : ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
2727 p12-password : ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
28- keychain : build-app
28+ keychain : build-app-${{ github.run_id }}
2929 keychain-password : ${{ github.run_id }}
3030
3131 - name : Install Installer certificate
3232 if : inputs.os == 'macos'
33- uses : apple-actions/import-codesign-certs@v5
33+ uses : apple-actions/import-codesign-certs@v3
3434 with :
3535 p12-file-base64 : ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
3636 p12-password : ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
37- keychain : build-installer
37+ keychain : build-installer-${{ github.run_id }}
3838 keychain-password : ${{ github.run_id }}
39- # We need to create a separate keychain for the installer certificate
40- create-keychain : true
4139
4240 - name : Verify certificates
4341 if : inputs.os == 'macos'
4442 shell : ${{ inputs.shell }}
4543 run : |
46- echo "Available signing identities in build-app keychain:"
47- security find-identity -v -p codesigning build-app.keychain
48- echo "Available signing identities in build-installer keychain:"
49- security find-identity -v -p codesigning build-installer.keychain
44+ echo "Available signing identities in app keychain:"
45+ security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain
46+
47+ echo "Available signing identities in installer keychain:"
48+ security find-identity -v -p codesigning build-installer-${{ github.run_id }}.keychain
49+
50+ # Make the keychains searchable
51+ security list-keychains -d user -s build-app-${{ github.run_id }}.keychain build-installer-${{ github.run_id }}.keychain $(security list-keychains -d user | tr -d '"')
52+ security default-keychain -s build-app-${{ github.run_id }}.keychain
53+ security unlock-keychain -p ${{ github.run_id }} build-app-${{ github.run_id }}.keychain
54+ security unlock-keychain -p ${{ github.run_id }} build-installer-${{ github.run_id }}.keychain
55+ security set-keychain-settings -t 3600 -l build-app-${{ github.run_id }}.keychain
56+ security set-keychain-settings -t 3600 -l build-installer-${{ github.run_id }}.keychain
5057
5158 - name : Set up Python and other macOS dependencies
5259 if : ${{ inputs.os == 'macos' }}
@@ -95,14 +102,10 @@ runs:
95102 dmg_file=$(find ./dist -name "*.dmg" -print -quit)
96103 if [ -n "$dmg_file" ]; then
97104 echo "Found DMG: $dmg_file"
98- # Try to get a signing identity from both keychains
99- SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-app.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
100- if [ -z "$SIGNING_IDENTITY" ]; then
101- echo "No valid Developer ID Application certificate found in build-app keychain, trying build-installer keychain"
102- SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-installer.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
103- fi
105+ # Get the first valid signing identity from the keychain
106+ SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
104107 if [ -z "$SIGNING_IDENTITY" ]; then
105- echo "Error: No valid Developer ID Application certificate found in any keychain"
108+ echo "Error: No valid Developer ID Application certificate found in keychain"
106109 exit 1
107110 fi
108111 echo "Using signing identity: $SIGNING_IDENTITY"
@@ -112,16 +115,6 @@ runs:
112115 xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
113116 # Staple the notarization ticket
114117 xcrun stapler staple "$dmg_file"
115- else
116- echo "No DMG found to sign"
117- fi
118- echo "Using signing identity: $SIGNING_IDENTITY"
119- # Sign the DMG
120- codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
121- # Notarize the DMG
122- xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
123- # Staple the notarization ticket
124- xcrun stapler staple "$dmg_file"
125118 else
126119 echo "No DMG found to sign"
127120 fi
0 commit comments