Skip to content

Commit dfe6c5b

Browse files
mokagioclaude
andcommitted
resolve codesign identity from keychain by team id
The hardcoded `Developer ID Application: Automattic, Inc. (...)` only worked for Automattic certs, so `--team-id` against a non-Automattic team would silently fall back to a misleading codesign error. Look up the full identity string from `security find-identity` instead, matching by team id, with `IDENTITY` env override for edge cases. CodeRabbit on PR #70. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 61a28eb commit dfe6c5b

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

scripts/sign-and-notarize-cli

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,26 @@ fi
6565
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
6666
cd "$repo_root"
6767

68-
identity="Developer ID Application: Automattic, Inc. (${team_id})"
68+
# Resolve the codesigning identity from the keychain by team id so the
69+
# script works for any Developer ID cert, not just the hardcoded org name.
70+
# `IDENTITY` env var bypasses the lookup if you need to force a specific cert.
71+
identity="${IDENTITY:-}"
72+
if [ -z "$identity" ]; then
73+
identity="$(security find-identity -v -p codesigning | awk -v team="(${team_id})" '
74+
/Developer ID Application:/ && index($0, team) {
75+
sub(/^[^"]*"/, "")
76+
sub(/"[^"]*$/, "")
77+
print
78+
exit
79+
}
80+
')"
81+
fi
82+
if [ -z "$identity" ]; then
83+
printf >&2 "no Developer ID Application identity for team %s in keychain\n" "$team_id"
84+
printf >&2 "(set IDENTITY=... to override)\n"
85+
exit 1
86+
fi
87+
6988
entitlements="$repo_root/scripts/imessage-cli.entitlements"
7089

7190
build_arch() {

0 commit comments

Comments
 (0)