Skip to content

Commit a7e750d

Browse files
committed
fix(ci): avoid ambiguous codesign identity
1 parent 84f1d07 commit a7e750d

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/release-macos-app.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@ jobs:
110110
111111
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> $GITHUB_ENV
112112
113+
- name: Resolve codesign identity
114+
run: |
115+
set -euo pipefail
116+
LINE="$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep 'Developer ID Application' | head -n 1 || true)"
117+
if [ -z "$LINE" ]; then
118+
echo "No Developer ID Application identity found in keychain: $KEYCHAIN_PATH"
119+
security find-identity -v -p codesigning "$KEYCHAIN_PATH" || true
120+
exit 1
121+
fi
122+
123+
IDENTITY_HASH="$(echo "$LINE" | awk '{print $2}')"
124+
IDENTITY_NAME="$(echo "$LINE" | sed -n 's/.*\"\\(Developer ID Application:.*\\)\".*/\\1/p')"
125+
126+
if [ -z "$IDENTITY_HASH" ] || [ -z "$IDENTITY_NAME" ]; then
127+
echo "Failed to parse identity from line: $LINE"
128+
exit 1
129+
fi
130+
131+
echo "CODESIGN_IDENTITY_HASH=$IDENTITY_HASH" >> "$GITHUB_ENV"
132+
echo "CODESIGN_IDENTITY_NAME=$IDENTITY_NAME" >> "$GITHUB_ENV"
133+
113134
- name: Bundle CLI into app resources
114135
env:
115136
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -155,7 +176,7 @@ jobs:
155176
fi
156177
157178
codesign --force --options runtime --timestamp \
158-
--sign "Developer ID Application" \
179+
--sign "$CODESIGN_IDENTITY_HASH" \
159180
--keychain "$KEYCHAIN_PATH" \
160181
"$BUNDLED_HACK"
161182
@@ -171,7 +192,7 @@ jobs:
171192
-configuration Release \
172193
-archivePath "$RUNNER_TEMP/HackDesktop.xcarchive" \
173194
CODE_SIGN_STYLE=Manual \
174-
CODE_SIGN_IDENTITY="Developer ID Application" \
195+
CODE_SIGN_IDENTITY="$CODESIGN_IDENTITY_NAME" \
175196
DEVELOPMENT_TEAM="$TEAM_ID" \
176197
OTHER_CODE_SIGN_FLAGS="--keychain $KEYCHAIN_PATH"
177198
@@ -191,7 +212,7 @@ jobs:
191212
<key>signingStyle</key>
192213
<string>manual</string>
193214
<key>signingCertificate</key>
194-
<string>Developer ID Application</string>
215+
<string>$CODESIGN_IDENTITY_NAME</string>
195216
</dict>
196217
</plist>
197218
EOF

0 commit comments

Comments
 (0)