Skip to content

Commit be69b35

Browse files
os-zhuangCopilot
andcommitted
ci(one): import Apple Developer ID cert + optional notarization
Adds a macOS-only 'Import Apple signing certificate' step that provisions an ephemeral keychain from APPLE_CERTIFICATE (.p12 base64) + APPLE_CERTIFICATE_PASSWORD. The step no-ops if APPLE_CERTIFICATE is empty, so the workflow still works without Apple secrets. Passes APPLE_SIGNING_IDENTITY + APPLE_TEAM_ID + APPLE_ID + APPLE_PASSWORD to 'tauri build'. Tauri v2 auto-detects: - cert present, no APPLE_ID/PASSWORD → sign only - cert + APPLE_ID + APPLE_PASSWORD → sign + notarize + staple Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0b95739 commit be69b35

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/one.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,44 @@ jobs:
8080
TARGET_ARCH: ${{ matrix.target-arch }}
8181
run: pnpm --filter @objectos/one stage
8282

83+
- name: Import Apple signing certificate
84+
if: runner.os == 'macOS'
85+
env:
86+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
87+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
88+
run: |
89+
set -euo pipefail
90+
if [ -z "${APPLE_CERTIFICATE:-}" ]; then
91+
echo "APPLE_CERTIFICATE not set — skipping (build will be unsigned)."
92+
exit 0
93+
fi
94+
95+
KEYCHAIN="$RUNNER_TEMP/build.keychain-db"
96+
KEYCHAIN_PASSWORD="$(openssl rand -base64 24)"
97+
CERT_PATH="$RUNNER_TEMP/cert.p12"
98+
99+
echo "$APPLE_CERTIFICATE" | base64 --decode > "$CERT_PATH"
100+
101+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
102+
security set-keychain-settings -lut 21600 "$KEYCHAIN"
103+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN"
104+
105+
security import "$CERT_PATH" -k "$KEYCHAIN" \
106+
-P "$APPLE_CERTIFICATE_PASSWORD" \
107+
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
108+
109+
security set-key-partition-list \
110+
-S apple-tool:,apple:,codesign: \
111+
-s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN" >/dev/null
112+
113+
# Put new keychain first in the search list (keep existing ones too).
114+
security list-keychains -d user -s "$KEYCHAIN" $(security list-keychains -d user | tr -d '"')
115+
116+
echo "Available signing identities:"
117+
security find-identity -v -p codesigning "$KEYCHAIN"
118+
119+
rm -f "$CERT_PATH"
120+
83121
- name: Build Tauri bundle
84122
env:
85123
# AppImage tools need FUSE on Linux; ubuntu-22.04 dropped it.
@@ -88,6 +126,12 @@ jobs:
88126
# Tauri updater key (no-password key generated via `signer generate --ci`).
89127
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
90128
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
129+
# macOS code signing (only used if cert was imported above).
130+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
131+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
132+
# macOS notarization (only triggered if APPLE_ID + APPLE_PASSWORD are set).
133+
APPLE_ID: ${{ secrets.APPLE_ID }}
134+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
91135
run: pnpm --filter @objectos/one tauri build --target ${{ matrix.target }}
92136

93137
- name: Upload artifacts

0 commit comments

Comments
 (0)