Skip to content

Commit 44a45a3

Browse files
atompilotclaude
andcommitted
feat: add Developer ID signing and Apple notarization to CI (v2.4.0)
- Import Developer ID certificate into temporary keychain in CI - Auto-detect signing identity via security find-identity - Pass notarization credentials via environment variables - Fall back to --keychain-profile for local development Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b3a5c10 commit 44a45a3

3 files changed

Lines changed: 36 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
build_script: windows/build.ps1
1818
artifact: windows/dist/claudecode-notification.exe
1919
- os: macos-latest
20-
build_script: macos/build.sh
2120
artifact: macos/dist/ClaudeCodeNotification.zip
2221

2322
runs-on: ${{ matrix.os }}
@@ -37,9 +36,33 @@ jobs:
3736
shell: pwsh
3837
run: .\${{ matrix.build_script }}
3938

40-
- name: Build (macOS)
39+
# ─── macOS:导入证书 + Developer ID 签名 + 公证 ───
40+
- name: Import signing certificate
4141
if: runner.os == 'macOS'
42-
run: bash ${{ matrix.build_script }}
42+
env:
43+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
44+
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
45+
run: |
46+
echo "$MACOS_CERTIFICATE" | base64 --decode > /tmp/cert.p12
47+
security create-keychain -p "" build.keychain
48+
security default-keychain -s build.keychain
49+
security unlock-keychain -p "" build.keychain
50+
security import /tmp/cert.p12 -k build.keychain \
51+
-P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
52+
security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain
53+
rm /tmp/cert.p12
54+
55+
- name: Build and notarize (macOS)
56+
if: runner.os == 'macOS'
57+
env:
58+
NOTARIZE_APPLE_ID: ${{ secrets.NOTARIZE_APPLE_ID }}
59+
NOTARIZE_APPLE_ID_PASSWORD: ${{ secrets.NOTARIZE_APPLE_ID_PASSWORD }}
60+
NOTARIZE_TEAM_ID: ${{ secrets.NOTARIZE_TEAM_ID }}
61+
run: |
62+
SIGN_IDENTITY=$(security find-identity -v -p codesigning build.keychain \
63+
| grep 'Developer ID Application' | head -1 \
64+
| sed -E 's/.*"(Developer ID Application: [^"]+)".*/\1/')
65+
bash macos/build.sh --sign "$SIGN_IDENTITY" --notarize
4366
4467
- name: Upload to GitHub Release
4568
uses: softprops/action-gh-release@v2

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.4.0

macos/build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,15 @@ if $DO_NOTARIZE; then
130130
ZIP_PATH="$DIST_DIR/$APP_NAME.zip"
131131
ditto -c -k --keepParent "$APP_DIR" "$ZIP_PATH"
132132
echo "==> Submitting for notarization …"
133-
xcrun notarytool submit "$ZIP_PATH" --keychain-profile "notarytool" --wait
133+
if [ -n "${NOTARIZE_APPLE_ID:-}" ]; then
134+
xcrun notarytool submit "$ZIP_PATH" \
135+
--apple-id "$NOTARIZE_APPLE_ID" \
136+
--password "$NOTARIZE_APPLE_ID_PASSWORD" \
137+
--team-id "$NOTARIZE_TEAM_ID" \
138+
--wait
139+
else
140+
xcrun notarytool submit "$ZIP_PATH" --keychain-profile "notarytool" --wait
141+
fi
134142
echo "==> Stapling …"
135143
xcrun stapler staple "$APP_DIR"
136144
# Re-create zip with stapled app

0 commit comments

Comments
 (0)