Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

v4.0.3 update

tilakpatel227e567cb538d2
diff --git a/.github/workflows/macos-codesign-check.yml b/.github/workflows/macos-codesign-check.yml
deleted file mode 100644
index b28e00119..000000000
--- a/.github/workflows/macos-codesign-check.yml
+++ /dev/null
@@ -1,344 +0,0 @@
-name: macOS — Codesign Smoke Test
-
-# Build a minimal arm64 .app bundle, run macdeployqt + lipo-thin, then sign
-# with Developer ID Application + hardened runtime + secure timestamp, and
-# run the same pre-flight checks the release pipeline does. Stops short of
-# notarization / DMG / upload, so this is a fast (~10 min) signal of whether
-# the sign step itself is healthy on the current runner image + Qt version.
-#
-# Does NOT embed Python.framework: that's a meaningful chunk of the real
-# bundle but it's also the slowest staging step and not what we want to
-# validate here. The Qt frameworks + plugins + Fincept main binary still
-# exercise every relevant codesign path (nested frameworks, sign inside-out,
-# hardened-runtime propagation, timestamp acquisition).
-#
-# Triggered manually via the Actions tab → "Run workflow".
-
-on:
- workflow_dispatch:
-
-env:
- BUILD_TYPE: Release
- QT_VERSION: "6.8.3"
- QT_MODULES: "qtcharts qtwebsockets qtmultimedia"
- APP_NAME: FinceptTerminal
- FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
-
-jobs:
- codesign-smoke:
- name: Build + Sign (no notary)
- runs-on: macos-15
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- submodules: recursive
- fetch-depth: 1
-
- - name: Set up ccache
- uses: hendrikmuhs/ccache-action@v1
- with:
- key: macos-codesign-smoke-${{ env.QT_VERSION }}
- max-size: 500M
-
- - name: Install build tools
- run: brew install ninja cmake || brew upgrade ninja cmake || true
-
- - name: Install Qt ${{ env.QT_VERSION }}
- uses: jurplel/install-qt-action@v4
- with:
- version: ${{ env.QT_VERSION }}
- arch: clang_64
- modules: ${{ env.QT_MODULES }}
- cache: true
- cache-key-prefix: qt-macos-codesign-smoke
-
- - name: Install Python 3.12
- run: brew install [email protected] || brew upgrade [email protected] || true
-
- - name: Generate .icns icon
- working-directory: fincept-qt
- run: |
- ICO="resources/fincept.ico"
- ICNS="resources/fincept.icns"
- if [ -f "${ICNS}" ]; then
- echo ".icns already exists"
- elif [ -f "${ICO}" ]; then
- ICONSET="$(mktemp -d)/fincept.iconset"
- mkdir -p "${ICONSET}"
- sips -s format png "${ICO}" --out "${ICONSET}/icon_512x512.png" \
- --resampleHeightWidth 512 512 2>/dev/null || true
- iconutil -c icns -o "${ICNS}" "${ICONSET}" || true
- fi
-
- - name: Configure CMake
- working-directory: fincept-qt
- run: |
- cmake -B build -G Ninja \
- -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
- -DCMAKE_PREFIX_PATH="${QT_ROOT_DIR}" \
- -DCMAKE_OSX_ARCHITECTURES=arm64 \
- -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
- -DCMAKE_C_COMPILER_LAUNCHER=ccache \
- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-
- - name: Build
- working-directory: fincept-qt
- run: cmake --build build --config ${{ env.BUILD_TYPE }} -j $(sysctl -n hw.logicalcpu)
-
- - name: Verify binary
- working-directory: fincept-qt
- run: |
- if [ -f "build/${{ env.APP_NAME }}.app/Contents/MacOS/${{ env.APP_NAME }}" ]; then
- BINARY="build/${{ env.APP_NAME }}.app/Contents/MacOS/${{ env.APP_NAME }}"
- elif [ -f "build/${{ env.APP_NAME }}" ]; then
- BINARY="build/${{ env.APP_NAME }}"
- else
- echo "::error::Binary not found"
- find build -maxdepth 3 -name "${{ env.APP_NAME }}*" || true
- exit 1
- fi
- echo "Binary: $BINARY ($(du -sh "$BINARY" | cut -f1))"
- lipo -info "$BINARY"
-
- - name: Ensure .app bundle layout exists
- working-directory: fincept-qt
- run: |
- set -euo pipefail
- BUILD_DIR="build"
- APP_BUNDLE="${BUILD_DIR}/${{ env.APP_NAME }}.app"
- if [ ! -d "${APP_BUNDLE}" ]; then
- mkdir -p "${APP_BUNDLE}/Contents/MacOS"
- cp "${BUILD_DIR}/${{ env.APP_NAME }}" "${APP_BUNDLE}/Contents/MacOS/${{ env.APP_NAME }}"
- chmod +x "${APP_BUNDLE}/Contents/MacOS/${{ env.APP_NAME }}"
- cat > "${APP_BUNDLE}/Contents/Info.plist" <<'PLIST'
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0"><dict>
- <key>CFBundleExecutable</key><string>FinceptTerminal</string>
- <key>CFBundleIdentifier</key><string>com.fincept.terminal</string>
- <key>CFBundleName</key><string>FinceptTerminal</string>
- <key>CFBundlePackageType</key><string>APPL</string>
- <key>CFBundleShortVersionString</key><string>4.0.3</string>
- <key>CFBundleVersion</key><string>4.0.3</string>
- <key>LSMinimumSystemVersion</key><string>13.0</string>
- <key>NSHighResolutionCapable</key><true/>
- </dict></plist>
- PLIST
- fi
-
- - name: Canonicalise bundle layout (move non-Mach-Os out of MacOS/)
- working-directory: fincept-qt
- run: |
- set -euo pipefail
- APP_BUNDLE="build/${{ env.APP_NAME }}.app"
- RES="${APP_BUNDLE}/Contents/Resources"
- mkdir -p "${RES}"
- # CMake's POST_BUILD copies scripts/, resources/, yt-dlp into
- # Contents/MacOS — codesign refuses to sign a bundle with non-
- # Mach-Os there. Move them aside before signing.
- for entry in "${APP_BUNDLE}/Contents/MacOS"/*; do
- [ -e "$entry" ] || continue
- base="$(basename "$entry")"
- [ "$base" = "${{ env.APP_NAME }}" ] && continue
- if file -h "$entry" 2>/dev/null | grep -q "Mach-O"; then
- continue
- fi
- mv "$entry" "${RES}/${base}"
- done
-
- - name: Run macdeployqt
- working-directory: fincept-qt
- run: |
- set -euo pipefail
- APP_BUNDLE="build/${{ env.APP_NAME }}.app"
- MACDEPLOYQT="${QT_ROOT_DIR}/bin/macdeployqt"
- if [ ! -x "${MACDEPLOYQT}" ]; then
- echo "::error::macdeployqt not found at ${MACDEPLOYQT}"
- exit 1
- fi
- "${MACDEPLOYQT}" "${APP_BUNDLE}" -verbose=1 -always-overwrite || \
- echo "::warning::macdeployqt exited non-zero — continuing"
-
- - name: Thin universal Mach-Os to arm64
- working-directory: fincept-qt
- run: |
- set -euo pipefail
- APP_BUNDLE="build/${{ env.APP_NAME }}.app"
- THINNED_COUNT=0
- while IFS= read -r f; do
- file -h "$f" 2>/dev/null | grep -q "Mach-O" || continue
- ARCHS=$(file -h "$f" 2>/dev/null | grep -oE "(arm64|x86_64|i386|ppc)" | sort -u | tr '\n' ',' | sed 's/,$//')
- [ "${ARCHS}" = "arm64" ] && continue
- if ! echo "${ARCHS}" | grep -q "arm64"; then
- echo "::warning::no arm64 slice in $f (archs: ${ARCHS}) — leaving as-is"
- continue
- fi
- chmod u+w "$f" 2>/dev/null || true
- if lipo -thin arm64 "$f" -output "$f" 2>/dev/null; then
- THINNED_COUNT=$((THINNED_COUNT + 1))
- else
- echo "::warning::lipo -thin arm64 failed for $f"
- fi
- done < <(find "${APP_BUNDLE}" -type f 2>/dev/null)
- echo " thinned ${THINNED_COUNT} Mach-O(s) to arm64"
-
- - name: Import Developer ID certificate
- env:
- P12_BASE64: ${{ secrets.MACOS_CERT_P12_BASE64 }}
- P12_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
- run: |
- set -euo pipefail
- if [ -z "${P12_BASE64}" ] || [ -z "${P12_PASSWORD}" ]; then
- echo "::error::MACOS_CERT_P12_BASE64 / MACOS_CERT_PASSWORD secrets not set"
- exit 1
- fi
- KEYCHAIN_PATH="$RUNNER_TEMP/build.keychain-db"
- P12_PATH="$RUNNER_TEMP/cert.p12"
- echo "$P12_BASE64" | base64 -d > "$P12_PATH"
- security create-keychain -p "$P12_PASSWORD" "$KEYCHAIN_PATH"
- security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
- security unlock-keychain -p "$P12_PASSWORD" "$KEYCHAIN_PATH"
- security import "$P12_PATH" -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
- security list-keychains -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | tr -d '"')
- security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$P12_PASSWORD" "$KEYCHAIN_PATH"
- IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | \
- grep -oE '"Developer ID Application:[^"]+"' | head -1 | tr -d '"')
- if [ -z "${IDENTITY}" ]; then
- echo "::error::No Developer ID Application identity found in imported keychain"
- security find-identity -v "$KEYCHAIN_PATH" || true
- exit 1
- fi
- echo "Using identity: ${IDENTITY}"
- echo "SIGNING_IDENTITY=${IDENTITY}" >> "$GITHUB_ENV"
- rm -f "$P12_PATH"
-
- - name: Sign bundle with hardened runtime
- working-directory: fincept-qt
- run: |
- set -euo pipefail
- APP_BUNDLE="build/${{ env.APP_NAME }}.app"
- ENT="$RUNNER_TEMP/entitlements.plist"
- cat > "$ENT" <<'EOF'
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0"><dict>
- <key>com.apple.security.cs.allow-jit</key><true/>
- <key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
- <key>com.apple.security.cs.allow-dyld-environment-variables</key><true/>
- <key>com.apple.security.cs.disable-library-validation</key><true/>
- <key>com.apple.security.network.client</key><true/>
- <key>com.apple.security.network.server</key><true/>
- </dict></plist>
- EOF
-
- echo "Stripping extended attributes..."
- xattr -cr "${APP_BUNDLE}" 2>/dev/null || true
-
- SIGN_FLAGS=(--force --options runtime --timestamp --sign "$SIGNING_IDENTITY")
-
- # Enumerate every Mach-O EXCEPT the bundle's main executable.
- MACHO_LIST="$RUNNER_TEMP/macho-files.txt"
- MAIN_EXE="${APP_BUNDLE}/Contents/MacOS/${{ env.APP_NAME }}"
- : > "${MACHO_LIST}"
- while IFS= read -r f; do
- [ "$f" = "${MAIN_EXE}" ] && continue
- if file -h "$f" 2>/dev/null | grep -q "Mach-O"; then
- printf '%s\n' "$f" >> "${MACHO_LIST}"
- fi
- done < <(find "${APP_BUNDLE}" -type f 2>/dev/null)
- MACHO_COUNT=$(wc -l < "${MACHO_LIST}" | tr -d ' ')
- echo " ${MACHO_COUNT} Mach-O(s) to sign (main exe is signed at bundle root)"
-
- echo "Removing any pre-existing signatures..."
- while IFS= read -r f; do
- codesign --remove-signature "$f" 2>/dev/null || true
- done < "${MACHO_LIST}"
- codesign --remove-signature "${MAIN_EXE}" 2>/dev/null || true
- codesign --remove-signature "${APP_BUNDLE}" 2>/dev/null || true
-
- echo "Signing every Mach-O leaf..."
- while IFS= read -r f; do
- codesign "${SIGN_FLAGS[@]}" "$f" >/dev/null
- done < "${MACHO_LIST}"
-
- echo "Signing nested frameworks / .app bundles (deepest first)..."
- BUNDLE_COUNT=0
- while IFS= read -r d; do
- codesign "${SIGN_FLAGS[@]}" "$d" >/dev/null
- BUNDLE_COUNT=$((BUNDLE_COUNT + 1))
- done < <(find "${APP_BUNDLE}/Contents" -mindepth 1 -depth -type d \
- \( -name "*.framework" -o -name "*.app" \) 2>/dev/null)
- echo " signed ${BUNDLE_COUNT} nested bundles"
-
- echo "Signing top-level bundle with entitlements..."
- codesign --force --options runtime --timestamp \
- --entitlements "$ENT" \
- --sign "$SIGNING_IDENTITY" \
- "${APP_BUNDLE}"
-
- echo "Verifying signature..."
- codesign --verify --deep --strict --verbose=2 "${APP_BUNDLE}"
- codesign --display --verbose=2 "${APP_BUNDLE}" 2>&1 | head -20
-
- - name: Pre-flight checks (no notary)
- working-directory: fincept-qt
- run: |
- set -euo pipefail
- APP_BUNDLE="build/${{ env.APP_NAME }}.app"
- MAIN_EXE="${APP_BUNDLE}/Contents/MacOS/${{ env.APP_NAME }}"
- MACHO_LIST="$RUNNER_TEMP/preflight-macho.txt"
- : > "${MACHO_LIST}"
- while IFS= read -r f; do
- if file -h "$f" 2>/dev/null | grep -q "Mach-O"; then
- printf '%s\n' "$f" >> "${MACHO_LIST}"
- fi
- done < <(find "${APP_BUNDLE}" -type f 2>/dev/null)
- MACHO_COUNT=$(wc -l < "${MACHO_LIST}" | tr -d ' ')
-
- BAD_RUNTIME=()
- BAD_TIMESTAMP=()
- BAD_ARCH=()
- while IFS= read -r f; do
- DISPLAY=$(codesign --display --verbose=2 "$f" 2>&1 || true)
- echo "${DISPLAY}" | grep -q "flags=.*runtime" || BAD_RUNTIME+=("$f")
- echo "${DISPLAY}" | grep -q "Timestamp=" || BAD_TIMESTAMP+=("$f")
- ARCHS=$(file -h "$f" 2>/dev/null | grep -oE "(arm64|x86_64|i386|ppc)" | sort -u | tr '\n' ',' | sed 's/,$//')
- [ "${ARCHS}" = "arm64" ] || BAD_ARCH+=("${f} [${ARCHS}]")
- done < "${MACHO_LIST}"
-
- OK=1
- if [ "${#BAD_RUNTIME[@]}" -gt 0 ]; then
- OK=0
- echo "::error::${#BAD_RUNTIME[@]} Mach-O(s) missing hardened runtime:"
- printf ' %s\n' "${BAD_RUNTIME[@]}" | head -30
- fi
- if [ "${#BAD_TIMESTAMP[@]}" -gt 0 ]; then
- OK=0
- echo "::error::${#BAD_TIMESTAMP[@]} Mach-O(s) missing secure timestamp:"
- printf ' %s\n' "${BAD_TIMESTAMP[@]}" | head -30
- fi
- if [ "${#BAD_ARCH[@]}" -gt 0 ]; then
- OK=0
- echo "::error::${#BAD_ARCH[@]} Mach-O(s) with unexpected arch (this build is arm64-only):"
- printf ' %s\n' "${BAD_ARCH[@]}" | head -30
- fi
- if codesign --display --entitlements - "${APP_BUNDLE}" 2>/dev/null | grep -q "get-task-allow"; then
- OK=0
- echo "::error::get-task-allow entitlement present — would block notarization"
- fi
-
- if [ "${OK}" -ne 1 ]; then
- echo "::error::Pre-flight FAILED"
- exit 1
- fi
- echo "Pre-flight PASSED: ${MACHO_COUNT} Mach-O(s), all arm64 + hardened-runtime + timestamped"
-
- - name: Upload signed bundle (zipped)
- if: always()
- uses: actions/upload-artifact@v4
- with:
- name: FinceptTerminal-signed-macos-arm64
- path: fincept-qt/build/FinceptTerminal.app
- retention-days: 7
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 40e190345..6e2e5dbd3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1245,25 +1245,82 @@ jobs:
# ditto preserves symlinks + xattrs correctly; `zip` doesn't.
/usr/bin/ditto -c -k --keepParent "${APP_BUNDLE}" "${ZIP_PATH}"
- # Submit and wait. `--output-format json` makes the result
- # machine-parseable. Important: `notarytool submit --wait` exits 0
- # even when Apple returns status: Invalid — the exit code only
- # signals "could we talk to Apple". The actual verdict lives in
- # the .status field, so we MUST inspect it ourselves. If we don't,
- # the next step (`stapler staple`) fails with a cryptic "Error 65"
- # because Apple never minted a ticket.
- echo "Submitting .app to Apple notary (this can take a few minutes)..."
- xcrun notarytool submit "${ZIP_PATH}" \
- --apple-id "$APPLE_ID" \
- --team-id "$TEAM_ID" \
- --password "$NOTARY_PASSWORD" \
- --wait \
- --output-format json | tee "${SUBMIT_JSON}"
-
- SUB_ID=$(jq -r '.id' < "${SUBMIT_JSON}")
- STATUS=$(jq -r '.status' < "${SUBMIT_JSON}")
- echo "Notarization submission ${SUB_ID} → ${STATUS}"
+ # Submit WITHOUT --wait so we get the submission UUID immediately,
+ # then poll status ourselves with retries. `notarytool submit --wait`
+ # has no retry on transient network errors: a single dropped
+ # connection during the multi-minute poll loop kills the step
+ # (NSURLErrorDomain -1009 from the runner's network stack), even
+ # though Apple's side accepted and is processing the submission
+ # just fine. By owning the poll loop we can retry on TCP/DNS
+ # blips without losing the in-flight submission.
+ echo "Submitting .app to Apple notary..."
+ SUBMIT_ATTEMPTS=0
+ SUB_ID=""
+ while [ "${SUBMIT_ATTEMPTS}" -lt 3 ]; do
+ SUBMIT_ATTEMPTS=$((SUBMIT_ATTEMPTS + 1))
+ if xcrun notarytool submit "${ZIP_PATH}" \
+ --apple-id "$APPLE_ID" \
+ --team-id "$TEAM_ID" \
+ --password "$NOTARY_PASSWORD" \
+ --output-format json > "${SUBMIT_JSON}" 2>&1; then
+ SUB_ID=$(jq -r '.id // empty' < "${SUBMIT_JSON}")
+ [ -n "${SUB_ID}" ] && break
+ fi
+ echo "::warning::submit attempt ${SUBMIT_ATTEMPTS} failed:"
+ cat "${SUBMIT_JSON}" || true
+ sleep $((SUBMIT_ATTEMPTS * 30))
+ done
+ if [ -z "${SUB_ID}" ]; then
+ echo "::error::Could not submit to notary after ${SUBMIT_ATTEMPTS} attempts"
+ exit 1
+ fi
+ echo "Submitted: ${SUB_ID}"
+
+ # Poll for completion. notarytool info returns one of: In Progress,
+ # Accepted, Invalid, Rejected. We retry network failures (curl/
+ # NSURLError) without resubmitting — the submission already exists
+ # on Apple's side, we just need to read its current state.
+ echo "Polling notarization status (this can take a few minutes)..."
+ STATUS="In Progress"
+ POLL_START=$(date +%s)
+ POLL_TIMEOUT_SEC=1800 # 30 min hard cap; Apple usually answers in 2-5 min
+ NETWORK_FAILS=0
+ INFO_JSON="$RUNNER_TEMP/notary-app-info.json"
+ while true; do
+ ELAPSED=$(( $(date +%s) - POLL_START ))
+ if [ "${ELAPSED}" -gt "${POLL_TIMEOUT_SEC}" ]; then
+ echo "::error::Notarization poll timed out after ${POLL_TIMEOUT_SEC}s (last status: ${STATUS})"
+ exit 1
+ fi
+ if xcrun notarytool info "${SUB_ID}" \
+ --apple-id "$APPLE_ID" \
+ --team-id "$TEAM_ID" \
+ --password "$NOTARY_PASSWORD" \
+ --output-format json > "${INFO_JSON}" 2>&1; then
+ NETWORK_FAILS=0
+ STATUS=$(jq -r '.status // "Unknown"' < "${INFO_JSON}")
+ echo " [${ELAPSED}s] status=${STATUS}"
+ case "${STATUS}" in
+ Accepted) break ;;
+ Invalid|Rejected) break ;;
+ "In Progress") sleep 20 ;;
+ *) sleep 20 ;;
+ esac
+ else
+ NETWORK_FAILS=$((NETWORK_FAILS + 1))
+ echo "::warning::notarytool info network failure #${NETWORK_FAILS}:"
+ cat "${INFO_JSON}" || true
+ if [ "${NETWORK_FAILS}" -ge 10 ]; then
+ echo "::error::10 consecutive network failures polling notarization — runner connectivity is broken"
+ exit 1
+ fi
+ # Exponential backoff capped at 60s — gives DNS/TCP time to recover.
+ sleep $(( NETWORK_FAILS * 5 < 60 ? NETWORK_FAILS * 5 : 60 ))
+ fi
+ done
+
+ echo "Notarization submission ${SUB_ID} → ${STATUS}"
if [ "${STATUS}" != "Accepted" ]; then
echo "::error::Notarization failed for .app (status: ${STATUS}). Fetching Apple's log..."
# `notarytool log <id>` returns the pretty-printed JSON log
@@ -1280,7 +1337,7 @@ jobs:
echo "Stapling ticket to .app..."
xcrun stapler staple "${APP_BUNDLE}"
xcrun stapler validate "${APP_BUNDLE}"
- rm -f "${ZIP_PATH}" "${SUBMIT_JSON}"
+ rm -f "${ZIP_PATH}" "${SUBMIT_JSON}" "${INFO_JSON}"
# ── Copy signed bundle to dist/ ───────────────────────────────────────
- name: Finalize dist
@@ -1341,23 +1398,72 @@ jobs:
echo "Signing DMG: ${DMG}"
codesign --force --sign "$SIGNING_IDENTITY" --timestamp "$DMG"
- # Same status-handling pattern as the .app notarization step
- # above — submit --wait can exit 0 on Invalid, so we parse
- # .status from the JSON and pull the log on rejection.
+ # Same submit-then-poll pattern as the .app step: --wait has no
+ # retry on transient network errors (NSURLErrorDomain -1009 from
+ # the runner), so we own the poll loop.
SUBMIT_JSON="$RUNNER_TEMP/notary-dmg-submit.json"
+ INFO_JSON="$RUNNER_TEMP/notary-dmg-info.json"
+
+ echo "Submitting DMG to Apple notary..."
+ SUBMIT_ATTEMPTS=0
+ SUB_ID=""
+ while [ "${SUBMIT_ATTEMPTS}" -lt 3 ]; do
+ SUBMIT_ATTEMPTS=$((SUBMIT_ATTEMPTS + 1))
+ if xcrun notarytool submit "$DMG" \
+ --apple-id "$APPLE_ID" \
+ --team-id "$TEAM_ID" \
+ --password "$NOTARY_PASSWORD" \
+ --output-format json > "${SUBMIT_JSON}" 2>&1; then
+ SUB_ID=$(jq -r '.id // empty' < "${SUBMIT_JSON}")
+ [ -n "${SUB_ID}" ] && break
+ fi
+ echo "::warning::DMG submit attempt ${SUBMIT_ATTEMPTS} failed:"
+ cat "${SUBMIT_JSON}" || true
+ sleep $((SUBMIT_ATTEMPTS * 30))
+ done
+ if [ -z "${SUB_ID}" ]; then
+ echo "::error::Could not submit DMG to notary after ${SUBMIT_ATTEMPTS} attempts"
+ exit 1
+ fi
+ echo "Submitted: ${SUB_ID}"
+
+ echo "Polling DMG notarization status..."
+ STATUS="In Progress"
+ POLL_START=$(date +%s)
+ POLL_TIMEOUT_SEC=1800
+ NETWORK_FAILS=0
+ while true; do
+ ELAPSED=$(( $(date +%s) - POLL_START ))
+ if [ "${ELAPSED}" -gt "${POLL_TIMEOUT_SEC}" ]; then
+ echo "::error::DMG notarization poll timed out after ${POLL_TIMEOUT_SEC}s (last: ${STATUS})"
+ exit 1
+ fi
+ if xcrun notarytool info "${SUB_ID}" \
+ --apple-id "$APPLE_ID" \
+ --team-id "$TEAM_ID" \
+ --password "$NOTARY_PASSWORD" \
+ --output-format json > "${INFO_JSON}" 2>&1; then
+ NETWORK_FAILS=0
+ STATUS=$(jq -r '.status // "Unknown"' < "${INFO_JSON}")
+ echo " [${ELAPSED}s] status=${STATUS}"
+ case "${STATUS}" in
+ Accepted) break ;;
+ Invalid|Rejected) break ;;
+ *) sleep 20 ;;
+ esac
+ else
+ NETWORK_FAILS=$((NETWORK_FAILS + 1))
+ echo "::warning::notarytool info network failure #${NETWORK_FAILS}:"
+ cat "${INFO_JSON}" || true
+ if [ "${NETWORK_FAILS}" -ge 10 ]; then
+ echo "::error::10 consecutive network failures — runner connectivity is broken"
+ exit 1
+ fi
+ sleep $(( NETWORK_FAILS * 5 < 60 ? NETWORK_FAILS * 5 : 60 ))
+ fi
+ done
- echo "Submitting to Apple notary service (this can take a few minutes)..."
- xcrun notarytool submit "$DMG" \
- --apple-id "$APPLE_ID" \
- --team-id "$TEAM_ID" \
- --password "$NOTARY_PASSWORD" \
- --wait \
- --output-format json | tee "${SUBMIT_JSON}"
-
- SUB_ID=$(jq -r '.id' < "${SUBMIT_JSON}")
- STATUS=$(jq -r '.status' < "${SUBMIT_JSON}")
echo "DMG notarization submission ${SUB_ID} → ${STATUS}"
-
if [ "${STATUS}" != "Accepted" ]; then
echo "::error::Notarization failed for DMG (status: ${STATUS}). Fetching Apple's log..."
xcrun notarytool log "${SUB_ID}" \
@@ -1372,7 +1478,7 @@ jobs:
xcrun stapler staple "$DMG"
xcrun stapler validate "$DMG"
spctl --assess --type open --context context:primary-signature -vv "$DMG" || true
- rm -f "${SUBMIT_JSON}"
+ rm -f "${SUBMIT_JSON}" "${INFO_JSON}"
# ── Clean up the temp keychain ────────────────────────────────────────
- name: Clean up keychain