Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 4d4dba6

Browse files
committed
Fix codesign macos for application and installer
1 parent dbc63a0 commit 4d4dba6

File tree

3 files changed

+55
-8
lines changed

3 files changed

+55
-8
lines changed

.github/workflows/cortex-build.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ jobs:
234234

235235
- os: "mac"
236236
name: "amd64"
237-
runs-on: "macos-desktop"
237+
runs-on: "macos-13"
238238

239239
- os: "mac"
240240
name: "arm64"
241-
runs-on: "macos-silicon"
241+
runs-on: "macos-latest"
242242
steps:
243243
- name: Clone
244244
id: checkout
@@ -279,7 +279,6 @@ jobs:
279279
registry-url: "https://registry.npmjs.org"
280280

281281
- uses: actions/setup-python@v3
282-
if: runner.os != 'macOS'
283282
with:
284283
python-version: "3.10"
285284

@@ -291,10 +290,10 @@ jobs:
291290

292291
- name: Get Cer for code signing
293292
if: runner.os == 'macOS'
294-
run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
293+
run: base64 -d <<< "$NOTARIZE_P8_BASE64" > /tmp/notary-key.p8
295294
shell: bash
296295
env:
297-
CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
296+
NOTARIZE_P8_BASE64: ${{ secrets.NOTARIZE_P8_BASE64 }}
298297

299298
- uses: apple-actions/import-codesign-certs@v2
300299
continue-on-error: true
@@ -328,6 +327,16 @@ jobs:
328327
./cortex --help
329328
make codesign-binary CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
330329
330+
# install quill
331+
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b /usr/local/bin
332+
333+
# Notarize the binary
334+
quill notarize ./cortex
335+
env:
336+
QUILL_NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }}
337+
QUILL_NOTARY_ISSUER: ${{ secrets.NOTARY_ISSUER }}
338+
QUILL_NOTARY_KEY: "/tmp/notary-key.p8"
339+
331340
- name: Create MacOS PKG Installer
332341
if: runner.os == 'macOS'
333342
run: |
@@ -338,7 +347,10 @@ jobs:
338347
pkgbuild --identifier ai.cortex.pkg --install-location ./usr/local/bin/ --root ./installer cortex-installer.pkg
339348
make codesign-installer CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
340349
341-
- name: Create MacOS PKG Installer
350+
# Notary the installer
351+
xcrun notarytool submit cortex-installer.pkg --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --wait
352+
353+
- name: Create Linux DEB Installer
342354
if: runner.os == 'Linux'
343355
run: |
344356
cd cortex-js

cortex-js/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ else ifeq ($(shell uname -s),Linux)
2929
@echo "Skipping Code Sign for linux"
3030
@exit 0
3131
else
32-
find "cortex" -type f -exec codesign --force -s "$(DEVELOPER_ID)" --options=runtime {} \;
32+
codesign --force -s "$(DEVELOPER_ID)" --options=runtime --entitlements="./entitlements.plist" ./cortex;
3333
endif
3434

3535
codesign-installer:
@@ -45,7 +45,9 @@ else ifeq ($(shell uname -s),Linux)
4545
@echo "Skipping Code Sign for linux"
4646
@exit 0
4747
else
48-
find "cortex" -type f -exec codesign --force -s "$(DEVELOPER_ID)" --options=runtime {} \;
48+
productsign --sign "Developer ID Installer: $(DEVELOPER_ID)" cortex-installer.pkg cortex-installer-signed.pkg;
49+
rm cortex-installer.pkg;
50+
mv cortex-installer-signed.pkg cortex-installer.pkg;
4951
endif
5052

5153
postbundle:

cortex-js/entitlements.plist

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- These are required for binaries built by PyInstaller -->
6+
<key>com.apple.security.cs.allow-jit</key>
7+
<true/>
8+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
9+
<true/>
10+
11+
<!-- Add these for additional permissions -->
12+
<key>com.apple.security.app-sandbox</key>
13+
<false/>
14+
<key>com.apple.security.network.client</key>
15+
<true/>
16+
<key>com.apple.security.network.server</key>
17+
<true/>
18+
<key>com.apple.security.device.audio-input</key>
19+
<true/>
20+
<key>com.apple.security.device.microphone</key>
21+
<true/>
22+
<key>com.apple.security.device.camera</key>
23+
<true/>
24+
<key>com.apple.security.files.user-selected.read-write</key>
25+
<true/>
26+
<key>com.apple.security.cs.disable-library-validation</key>
27+
<true/>
28+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
29+
<true/>
30+
<key>com.apple.security.cs.allow-executable-memory</key>
31+
<true/>
32+
</dict>
33+
</plist>

0 commit comments

Comments
 (0)