Skip to content

Commit 4c8cdff

Browse files
authored
trust mac signing cert in release workflow (#27)
1 parent 8348466 commit 4c8cdff

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,45 @@ jobs:
434434
Select-Object -Unique
435435
"PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
436436
437+
- name: Trust macOS signing certificate
438+
if: matrix.platform == 'mac'
439+
shell: bash
440+
env:
441+
CSC_LINK: ${{ secrets.CSC_LINK }}
442+
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
443+
run: |
444+
if [[ -z "$CSC_LINK" || -z "$CSC_KEY_PASSWORD" ]]; then
445+
echo "macOS signing certificate trust skipped (missing code-signing certificate secrets)."
446+
exit 0
447+
fi
448+
449+
cert_p12="$RUNNER_TEMP/t3code-mac-codesign.p12"
450+
cert_pem="$RUNNER_TEMP/t3code-mac-codesign.pem"
451+
452+
if [[ "$CSC_LINK" == file://* ]]; then
453+
cp "${CSC_LINK#file://}" "$cert_p12"
454+
elif [[ -f "$CSC_LINK" ]]; then
455+
cp "$CSC_LINK" "$cert_p12"
456+
else
457+
printf '%s' "$CSC_LINK" | openssl base64 -d -A -out "$cert_p12"
458+
fi
459+
460+
openssl pkcs12 \
461+
-in "$cert_p12" \
462+
-passin env:CSC_KEY_PASSWORD \
463+
-nokeys \
464+
-clcerts \
465+
-out "$cert_pem"
466+
467+
security add-trusted-cert \
468+
-d \
469+
-r trustRoot \
470+
-p codeSign \
471+
-k "$HOME/Library/Keychains/login.keychain-db" \
472+
"$cert_pem"
473+
474+
echo "macOS signing certificate trusted for code signing."
475+
437476
- name: Build desktop artifact
438477
shell: bash
439478
env:

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Long term maintainability is a core priority. If you add new functionality, firs
3131
- Keep workflow-only fork changes narrow and prefer job-level disables over broad refactors.
3232
- Do not commit package version bumps solely to represent fork releases.
3333
- Keep macOS release signing separate from Apple notarization; do not require notarization secrets just to sign updater artifacts.
34+
- Keep self-signed macOS signing certificate trust in the release workflow when using non-Apple signing certificates.
3435
- Re-check Electron updater channel behavior when changing version strings, release metadata, or desktop packaging.
3536
- Keep fork-only storage in `state-tarik02.sqlite` unless intentionally upstreaming it.
3637
- When preparing fork PRs, branch from `origin/main` and target `tarik02/t3code:main`.

FORK.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This repository is a fork of `pingdotgg/t3code`. Keep this file focused on fork
1010
- Release builds publish updater metadata against the fork repository.
1111
- Fork release versions are derived in the release workflow so package manifests stay close to upstream.
1212
- macOS release signing is separate from Apple notarization.
13+
- Self-signed macOS signing certificates are trusted during release builds.
1314

1415
### Desktop Updater Channels
1516

0 commit comments

Comments
 (0)