Skip to content

Commit e4b0fee

Browse files
committed
chore: Improve macOS codesigning script
- Update shebang to `#!/bin/bash` and enable strict mode with `set -euo pipefail`. - Introduce variables for keychain name, password, path, and certificate path to improve readability and maintainability. - Add a check to create the keychain only if it doesn't already exist. - Update `security` commands to use the newly defined path variables for clarity.
1 parent fa98df9 commit e4b0fee

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
set -euo pipefail
23

3-
security create-keychain -p "" build.keychain
4-
security default-keychain -s build.keychain
5-
security unlock-keychain -p "" build.keychain
4+
KEYCHAIN_NAME="build.keychain-db"
5+
KEYCHAIN_PASSWORD=""
6+
KEYCHAIN_PATH="$HOME/Library/Keychains/$KEYCHAIN_NAME"
7+
P12_PATH=".github/secrets/macos_dev_id_cert.p12"
68

7-
security import ./app/desktop/macOS_development.p12 \
8-
-k build.keychain \
9+
# Create keychain if it doesn't exist yet
10+
if [ ! -f "$KEYCHAIN_PATH" ]; then
11+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_NAME"
12+
fi
13+
14+
# Add keychain to the search list and make it default for this session
15+
security list-keychains -s "$KEYCHAIN_PATH" $(security list-keychains | sed 's/[",]//g')
16+
security default-keychain -s "$KEYCHAIN_PATH"
17+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
18+
19+
# Import Developer ID certificate
20+
security import "$P12_PATH" \
21+
-k "$KEYCHAIN_PATH" \
922
-P "$LARGE_SECRET_PASSPHRASE" \
10-
-T /usr/bin/codesign -T /usr/bin/productbuild -T /usr/bin/security
23+
-T /usr/bin/codesign \
24+
-T /usr/bin/productbuild
1125

12-
security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain
26+
# Allow non-interactive access for codesign / productbuild / notarytool
27+
security set-key-partition-list \
28+
-S apple-tool:,apple: \
29+
-s \
30+
-k "$KEYCHAIN_PASSWORD" \
31+
"$KEYCHAIN_PATH"

app/desktop/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ compose.desktop {
5050
nativeDistributions {
5151
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
5252
packageName = "Note Delight"
53-
packageVersion = "8.4.603"
53+
packageVersion = "8.4.604"
5454
description = "Note app with encryption"
5555
copyright = "© 2023 SoftArtDev"
5656
macOS.iconFile.set(project.file("src/jvmMain/resources/app_icon.icns"))

0 commit comments

Comments
 (0)