Skip to content

Commit 313e1ba

Browse files
authored
Merge branch 'main' into add-github-action-for-nix
2 parents f86246e + 84c9b57 commit 313e1ba

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/rust-release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,69 @@ jobs:
206206
codesign --force --options runtime --timestamp --sign "$APPLE_CODESIGN_IDENTITY" "${keychain_args[@]}" "$path"
207207
done
208208
209+
- if: ${{ matrix.runner == 'macos-14' }}
210+
name: Notarize macOS binaries
211+
shell: bash
212+
env:
213+
APPLE_NOTARIZATION_KEY_P8: ${{ secrets.APPLE_NOTARIZATION_KEY_P8 }}
214+
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
215+
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
216+
run: |
217+
set -euo pipefail
218+
219+
for var in APPLE_NOTARIZATION_KEY_P8 APPLE_NOTARIZATION_KEY_ID APPLE_NOTARIZATION_ISSUER_ID; do
220+
if [[ -z "${!var:-}" ]]; then
221+
echo "$var is required for notarization"
222+
exit 1
223+
fi
224+
done
225+
226+
notary_key_path="${RUNNER_TEMP}/notarytool.key.p8"
227+
echo "$APPLE_NOTARIZATION_KEY_P8" | base64 -d > "$notary_key_path"
228+
cleanup_notary() {
229+
rm -f "$notary_key_path"
230+
}
231+
trap cleanup_notary EXIT
232+
233+
notarize_binary() {
234+
local binary="$1"
235+
local source_path="target/${{ matrix.target }}/release/${binary}"
236+
local archive_path="${RUNNER_TEMP}/${binary}.zip"
237+
238+
if [[ ! -f "$source_path" ]]; then
239+
echo "Binary $source_path not found"
240+
exit 1
241+
fi
242+
243+
rm -f "$archive_path"
244+
ditto -c -k --keepParent "$source_path" "$archive_path"
245+
246+
submission_json=$(xcrun notarytool submit "$archive_path" \
247+
--key "$notary_key_path" \
248+
--key-id "$APPLE_NOTARIZATION_KEY_ID" \
249+
--issuer "$APPLE_NOTARIZATION_ISSUER_ID" \
250+
--output-format json \
251+
--wait)
252+
253+
status=$(printf '%s\n' "$submission_json" | jq -r '.status // "Unknown"')
254+
submission_id=$(printf '%s\n' "$submission_json" | jq -r '.id // ""')
255+
256+
if [[ -z "$submission_id" ]]; then
257+
echo "Failed to retrieve submission ID for $binary"
258+
exit 1
259+
fi
260+
261+
echo "::notice title=Notarization::$binary submission ${submission_id} completed with status ${status}"
262+
263+
if [[ "$status" != "Accepted" ]]; then
264+
echo "Notarization failed for ${binary} (submission ${submission_id}, status ${status})"
265+
exit 1
266+
fi
267+
}
268+
269+
notarize_binary "codex"
270+
notarize_binary "codex-responses-api-proxy"
271+
209272
- name: Stage artifacts
210273
shell: bash
211274
run: |

0 commit comments

Comments
 (0)