Skip to content

Commit fcc4c91

Browse files
authored
Merge pull request #25 from sozercan/agent/development-signed-releases
ci: allow development-signed releases
2 parents 454cbed + 1667dc2 commit fcc4c91

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ jobs:
8989
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
9090
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
9191
EXPECTED_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
92-
REQUIRE_DEVELOPER_ID: ${{ github.event_name == 'push' || inputs.publish }}
92+
REQUIRE_SIGNED_RELEASE: ${{ github.event_name == 'push' || inputs.publish }}
9393
run: |
9494
set -euo pipefail
9595
9696
fallback_to_adhoc() {
9797
local reason="$1"
98-
if [ "$REQUIRE_DEVELOPER_ID" = "true" ]; then
98+
if [ "$REQUIRE_SIGNED_RELEASE" = "true" ]; then
9999
echo "ERROR: $reason" >&2
100100
exit 1
101101
fi
@@ -104,7 +104,7 @@ jobs:
104104
echo "mode=adhoc" >> "$GITHUB_OUTPUT"
105105
}
106106
107-
if [ "$REQUIRE_DEVELOPER_ID" = "true" ] && [ -z "$EXPECTED_TEAM_ID" ]; then
107+
if [ "$REQUIRE_SIGNED_RELEASE" = "true" ] && [ -z "$EXPECTED_TEAM_ID" ]; then
108108
echo "ERROR: APPLE_TEAM_ID is required for public release signing." >&2
109109
exit 1
110110
fi
@@ -164,15 +164,15 @@ jobs:
164164
165165
APPLE_DEVELOPMENT=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" 2>/dev/null \
166166
| awk '/Apple Development/ { print $2; exit }' || true)
167-
if [ -n "$APPLE_DEVELOPMENT" ] && [ "$REQUIRE_DEVELOPER_ID" != "true" ]; then
167+
if [ -n "$APPLE_DEVELOPMENT" ]; then
168168
echo "::add-mask::$APPLE_DEVELOPMENT"
169-
echo "::warning::Using Apple Development signing; this build will not be notarized."
169+
echo "::warning::Using Apple Development signing; this release will not be notarized."
170170
echo "identity=$APPLE_DEVELOPMENT" >> "$GITHUB_OUTPUT"
171171
echo "mode=development" >> "$GITHUB_OUTPUT"
172172
exit 0
173173
fi
174174
175-
fallback_to_adhoc "The imported keychain has no usable Developer ID Application identity."
175+
fallback_to_adhoc "The imported keychain has no usable Developer ID Application or Apple Development identity."
176176
177177
- name: Build and sign release app
178178
id: app
@@ -183,6 +183,7 @@ jobs:
183183
OPEN_IN_CODE_SIGNING: unsigned
184184
SIGNING_IDENTITY: ${{ steps.signing.outputs.identity }}
185185
SIGNING_MODE: ${{ steps.signing.outputs.mode }}
186+
EXPECTED_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
186187
run: |
187188
set -euo pipefail
188189
@@ -221,6 +222,19 @@ jobs:
221222
ENTITLEMENTS=$(codesign -d --entitlements :- "$APP_PATH" 2>/dev/null)
222223
grep -F 'com.apple.security.automation.apple-events' <<< "$ENTITLEMENTS" >/dev/null
223224
225+
if [ "$SIGNING_MODE" != "adhoc" ]; then
226+
SIGNED_TEAM_ID=$(codesign -dvv "$APP_PATH" 2>&1 \
227+
| sed -n 's/^TeamIdentifier=//p')
228+
if [ -z "$SIGNED_TEAM_ID" ]; then
229+
echo "Signed app has no team identifier." >&2
230+
exit 1
231+
fi
232+
if [ -n "$EXPECTED_TEAM_ID" ] && [ "$SIGNED_TEAM_ID" != "$EXPECTED_TEAM_ID" ]; then
233+
echo "Signed app team ID '$SIGNED_TEAM_ID' does not match APPLE_TEAM_ID '$EXPECTED_TEAM_ID'." >&2
234+
exit 1
235+
fi
236+
fi
237+
224238
echo "path=$APP_PATH" >> "$GITHUB_OUTPUT"
225239
226240
- name: Notarize Developer ID app

0 commit comments

Comments
 (0)