From ade4cbdbab269e2dabdbb1eb7af425fec68f5894 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 04:35:51 +0000 Subject: [PATCH 1/2] Initial plan From 394fed153c2f7c1ea7b5ec8a077fa6966225170f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 04:38:01 +0000 Subject: [PATCH 2/2] Improve script/sign with better error handling and bash best practices Co-authored-by: darkangelpraha <183031713+darkangelpraha@users.noreply.github.com> --- script/sign | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/script/sign b/script/sign index f07a7d2d46e..00a4a23d48f 100755 --- a/script/sign +++ b/script/sign @@ -2,19 +2,34 @@ # usage: script/sign # # Signs macOS binaries using codesign, notarizes macOS zip archives using notarytool -# + set -e -sign_macos() { - if [[ -z "$APPLE_DEVELOPER_ID" ]]; then - echo "skipping macOS code-signing; APPLE_DEVELOPER_ID not set" >&2 - return 0 +required_env_vars=("APPLE_DEVELOPER_ID" "APPLE_ID" "APPLE_ID_PASSWORD") + +check_env_vars() { + local missing=() + for var in "${required_env_vars[@]}"; do + if [[ -z "${!var}" ]]; then + missing+=("$var") + fi + done + if (( ${#missing[@]} )); then + echo "Error: Missing required environment variables: ${missing[*]}" >&2 + exit 1 fi +} - if [[ $1 == *.zip ]]; then - xcrun notarytool submit "$1" --apple-id "${APPLE_ID?}" --team-id "${APPLE_DEVELOPER_ID?}" --password "${APPLE_ID_PASSWORD?}" +sign_macos() { + local input_file="$1" + if [[ $input_file == *.zip ]]; then + xcrun notarytool submit "$input_file" \ + --apple-id "${APPLE_ID}" \ + --team-id "${APPLE_DEVELOPER_ID}" \ + --password "${APPLE_ID_PASSWORD}" else - codesign --timestamp --options=runtime -s "${APPLE_DEVELOPER_ID?}" -v "$1" + codesign --timestamp --options=runtime \ + -s "${APPLE_DEVELOPER_ID}" -v "$input_file" fi } @@ -29,6 +44,8 @@ if [[ $platform != "Darwin" ]]; then exit 1 fi -for input_file; do +check_env_vars + +for input_file in "$@"; do sign_macos "$input_file" done