@@ -127,6 +127,20 @@ jobs:
127127 - name : Test executable
128128 run : time $PATH_TO_CYCODE_CLI_EXECUTABLE version
129129
130+ - name : Codesign onedir binaries
131+ if : runner.os == 'macOS' && matrix.mode == 'onedir'
132+ env :
133+ APPLE_CERT_NAME : ${{ secrets.APPLE_CERT_NAME }}
134+ run : |
135+ # Sign all Mach-O binaries (dylibs, shared objects) in the onedir output
136+ # Main executable must be signed last after all its dependencies
137+ find dist/cycode-cli -type f \( -name "*.dylib" -o -name "*.so" \) | while read -r file; do
138+ codesign --force --sign "$APPLE_CERT_NAME" --timestamp --options runtime "$file"
139+ done
140+
141+ # Re-sign the main executable with entitlements (must be last)
142+ codesign --force --sign "$APPLE_CERT_NAME" --timestamp --options runtime --entitlements entitlements.plist dist/cycode-cli/cycode-cli
143+
130144 - name : Notarize macOS executable
131145 if : runner.os == 'macOS'
132146 env :
@@ -137,11 +151,26 @@ jobs:
137151 # create keychain profile
138152 xcrun notarytool store-credentials "notarytool-profile" --apple-id "$APPLE_NOTARIZATION_EMAIL" --team-id "$APPLE_NOTARIZATION_TEAM_ID" --password "$APPLE_NOTARIZATION_PWD"
139153
140- # create zip file (notarization does not support binaries)
154+ # create zip file (notarization does not support bare binaries)
141155 ditto -c -k --keepParent dist/cycode-cli notarization.zip
142156
143157 # notarize app (this will take a while)
144- xcrun notarytool submit notarization.zip --keychain-profile "notarytool-profile" --wait
158+ NOTARIZE_OUTPUT=$(xcrun notarytool submit notarization.zip --keychain-profile "notarytool-profile" --wait 2>&1) || true
159+ echo "$NOTARIZE_OUTPUT"
160+
161+ # extract submission ID for log retrieval
162+ SUBMISSION_ID=$(echo "$NOTARIZE_OUTPUT" | grep " id:" | head -1 | awk '{print $2}')
163+
164+ # check notarization status explicitly
165+ if echo "$NOTARIZE_OUTPUT" | grep -q "status: Accepted"; then
166+ echo "Notarization succeeded!"
167+ else
168+ echo "Notarization failed! Fetching log for details..."
169+ if [ -n "$SUBMISSION_ID" ]; then
170+ xcrun notarytool log "$SUBMISSION_ID" --keychain-profile "notarytool-profile" || true
171+ fi
172+ exit 1
173+ fi
145174
146175 # we can't staple the app because it's executable
147176
0 commit comments