Skip to content

Commit f9f7a72

Browse files
authored
Merge branch 'main' into CM-59977-sca-cli-maintainability-improvements
2 parents f8984e2 + 457022c commit f9f7a72

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

.github/workflows/build_executable.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,22 @@ 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 in the onedir output (excluding the main executable)
136+
# Main executable must be signed last after all its dependencies
137+
find dist/cycode-cli -type f ! -name "cycode-cli" | while read -r file; do
138+
if file -b "$file" | grep -q "Mach-O"; then
139+
codesign --force --sign "$APPLE_CERT_NAME" --timestamp --options runtime "$file"
140+
fi
141+
done
142+
143+
# Re-sign the main executable with entitlements (must be last)
144+
codesign --force --sign "$APPLE_CERT_NAME" --timestamp --options runtime --entitlements entitlements.plist dist/cycode-cli/cycode-cli
145+
130146
- name: Notarize macOS executable
131147
if: runner.os == 'macOS'
132148
env:
@@ -137,11 +153,26 @@ jobs:
137153
# create keychain profile
138154
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$APPLE_NOTARIZATION_EMAIL" --team-id "$APPLE_NOTARIZATION_TEAM_ID" --password "$APPLE_NOTARIZATION_PWD"
139155
140-
# create zip file (notarization does not support binaries)
156+
# create zip file (notarization does not support bare binaries)
141157
ditto -c -k --keepParent dist/cycode-cli notarization.zip
142158
143159
# notarize app (this will take a while)
144-
xcrun notarytool submit notarization.zip --keychain-profile "notarytool-profile" --wait
160+
NOTARIZE_OUTPUT=$(xcrun notarytool submit notarization.zip --keychain-profile "notarytool-profile" --wait 2>&1) || true
161+
echo "$NOTARIZE_OUTPUT"
162+
163+
# extract submission ID for log retrieval
164+
SUBMISSION_ID=$(echo "$NOTARIZE_OUTPUT" | grep " id:" | head -1 | awk '{print $2}')
165+
166+
# check notarization status explicitly
167+
if echo "$NOTARIZE_OUTPUT" | grep -q "status: Accepted"; then
168+
echo "Notarization succeeded!"
169+
else
170+
echo "Notarization failed! Fetching log for details..."
171+
if [ -n "$SUBMISSION_ID" ]; then
172+
xcrun notarytool log "$SUBMISSION_ID" --keychain-profile "notarytool-profile" || true
173+
fi
174+
exit 1
175+
fi
145176
146177
# we can't staple the app because it's executable
147178

cycode/cli/files_collector/sca/base_restore_dependencies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def execute_commands(
3131
'output_file_path': output_file_path,
3232
},
3333
)
34+
3435
if not commands:
3536
return None
3637

0 commit comments

Comments
 (0)