Skip to content

Commit 4787da7

Browse files
committed
add apple signing
1 parent 9e19616 commit 4787da7

File tree

5 files changed

+149
-9
lines changed

5 files changed

+149
-9
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,31 @@ jobs:
4949
cd react
5050
npm run build
5151
52-
# - name: Build Electron app
53-
# run: |
54-
# cd electron
55-
# npm run build
52+
- name: Install Apple certificate
53+
if: matrix.os == 'macos-latest'
54+
run: |
55+
echo "$CERTIFICATE_P12" | base64 --decode > certificate.p12
56+
security create-keychain -p "" build.keychain
57+
security default-keychain -s build.keychain
58+
security unlock-keychain -p "" build.keychain
59+
security import certificate.p12 -k build.keychain -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign
60+
security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain
61+
env:
62+
CERTIFICATE_P12: ${{ secrets.CERTIFICATE_P12 }}
63+
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
64+
65+
- name: Set env for mac signing
66+
if: matrix.os == 'macos-latest'
67+
run: echo "CSC_LINK=certificate.p12" >> $GITHUB_ENV && echo "CSC_KEY_PASSWORD=${{ secrets.CERTIFICATE_PASSWORD }}" >> $GITHUB_ENV
5668

5769
- name: Build and Package Electron app
5870
run: |
5971
npx electron-builder --${{ matrix.os == 'macos-latest' && 'mac' || 'win' }} --publish always
6072
env:
6173
GH_TOKEN: ${{ secrets.GH_TOKEN }}
74+
APPLE_ID: ${{ secrets.APPLE_ID }}
75+
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
76+
TEAM_ID: ${{ secrets.TEAM_ID }}
6277

6378
- name: Upload artifacts
6479
uses: actions/upload-artifact@v4

entitlements.mac.plist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8+
<true/>
9+
<key>com.apple.security.cs.disable-library-validation</key>
10+
<true/>
11+
<key>com.apple.security.inherit</key>
12+
<true/>
13+
</dict>
14+
</plist>

package-lock.json

Lines changed: 96 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@
4545
"mac": {
4646
"category": "public.app-category.utilities",
4747
"icon": "assets/icons/unicorn.icns",
48-
"target": [
49-
"dmg",
50-
"zip"
51-
]
48+
"target": "dmg",
49+
"hardenedRuntime": true,
50+
"entitlements": "entitlements.mac.plist",
51+
"entitlementsInherit": "entitlements.mac.plist",
52+
"gatekeeperAssess": false
5253
},
54+
"afterSign": "./scripts/notarize.js",
5355
"win": {
5456
"icon": "assets/icons/unicorn.ico",
5557
"target": [

scripts/notarize.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const { notarize } = require("electron-notarize");
2+
3+
exports.default = async function notarizing(context) {
4+
const { electronPlatformName, appOutDir } = context;
5+
if (electronPlatformName !== "darwin") return;
6+
7+
return await notarize({
8+
appBundleId: "com.jaaz.app",
9+
appPath: `${appOutDir}/Jaaz.app`, // Replace with your actual .app name
10+
appleId: process.env.APPLE_ID,
11+
appleIdPassword: process.env.APPLE_APP_PASSWORD,
12+
teamId: process.env.TEAM_ID,
13+
});
14+
};

0 commit comments

Comments
 (0)