Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(ci): notarize macOS release DMGs (#7524)
Eric Hayes9e7c985f00bb
diff --git a/.github/workflows/build_desktop_on_tag.yml b/.github/workflows/build_desktop_on_tag.ymlindex 9041ff0be5..ec19f9c334 100644--- a/.github/workflows/build_desktop_on_tag.yml+++ b/.github/workflows/build_desktop_on_tag.yml@@ -333,9 +333,48 @@ jobs:cat "$dylib_refs" >&2exit 1fi+ shell: bash+ - name: Notarize and staple DMG+ run: |+ set -euo pipefail+ if [ -z "${DOPPLER_TOKEN:-}" ]; then+ echo "MACOS_RELEASE_DOPPLER_TOKEN must grant read access to macos-release/prd" >&2+ exit 1+ fi+ dmg=$(find artifacts -maxdepth 1 -type f -name '*.dmg' -print -quit)+ if [ -z "$dmg" ]; then+ echo "No DMG found to notarize" >&2+ exit 1+ fi++ umask 077+ credentials_dir=$(mktemp -d)+ trap 'rm -rf "$credentials_dir"' EXIT+ curl --fail --silent --show-error --retry 3 \+ --header "Authorization: Bearer $DOPPLER_TOKEN" \+ 'https://api.doppler.com/v3/configs/config/secrets/download?project=macos-release&config=prd&format=json&secrets=APPLE_API_PRIVATE_KEY,APPLE_API_KEY_ID,APPLE_API_ISSUER' \+ > "$credentials_dir/secrets.json"+ jq -er '.APPLE_API_PRIVATE_KEY | strings | select(length > 0)' \+ "$credentials_dir/secrets.json" > "$credentials_dir/AuthKey.p8"+ key_id=$(jq -er '.APPLE_API_KEY_ID | strings | select(length > 0)' "$credentials_dir/secrets.json")+ issuer=$(jq -er '.APPLE_API_ISSUER | strings | select(length > 0)' "$credentials_dir/secrets.json")++ # Submission failure, rejection, or timeout must prevent publishing this build.+ xcrun notarytool submit "$dmg" \+ --key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \+ --wait --timeout 30m --output-format json > "$credentials_dir/submission.json"+ cat "$credentials_dir/submission.json"+ jq -e '.status == "Accepted"' "$credentials_dir/submission.json" > /dev/null+ xcrun stapler staple "$dmg"+ xcrun stapler validate "$dmg"+ spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"++ # Stapling changes the DMG bytes, so checksum the final distributable.(cd artifacts && shasum -a 256 -- *.dmg > macro-dmg-SHA256SUMS)shell: bash+ env:+ DOPPLER_TOKEN: ${{ secrets.MACOS_RELEASE_DOPPLER_TOKEN }}- name: Upload macro-dmg-${{ steps.metadata.outputs.safe_tag }} artifactuses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02with:diff --git a/.github/workflows/build_dmg_on_tag.yml b/.github/workflows/build_dmg_on_tag.ymlindex 310586a704..c358e70256 100644--- a/.github/workflows/build_dmg_on_tag.yml+++ b/.github/workflows/build_dmg_on_tag.yml@@ -160,9 +160,48 @@ jobs:cat "$dylib_refs" >&2exit 1fi+ shell: bash+ - name: Notarize and staple DMG+ run: |+ set -euo pipefail+ if [ -z "${DOPPLER_TOKEN:-}" ]; then+ echo "MACOS_RELEASE_DOPPLER_TOKEN must grant read access to macos-release/prd" >&2+ exit 1+ fi+ dmg=$(find artifacts -maxdepth 1 -type f -name '*.dmg' -print -quit)+ if [ -z "$dmg" ]; then+ echo "No DMG found to notarize" >&2+ exit 1+ fi++ umask 077+ credentials_dir=$(mktemp -d)+ trap 'rm -rf "$credentials_dir"' EXIT+ curl --fail --silent --show-error --retry 3 \+ --header "Authorization: Bearer $DOPPLER_TOKEN" \+ 'https://api.doppler.com/v3/configs/config/secrets/download?project=macos-release&config=prd&format=json&secrets=APPLE_API_PRIVATE_KEY,APPLE_API_KEY_ID,APPLE_API_ISSUER' \+ > "$credentials_dir/secrets.json"+ jq -er '.APPLE_API_PRIVATE_KEY | strings | select(length > 0)' \+ "$credentials_dir/secrets.json" > "$credentials_dir/AuthKey.p8"+ key_id=$(jq -er '.APPLE_API_KEY_ID | strings | select(length > 0)' "$credentials_dir/secrets.json")+ issuer=$(jq -er '.APPLE_API_ISSUER | strings | select(length > 0)' "$credentials_dir/secrets.json")++ # Submission failure, rejection, or timeout must prevent publishing this build.+ xcrun notarytool submit "$dmg" \+ --key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \+ --wait --timeout 30m --output-format json > "$credentials_dir/submission.json"+ cat "$credentials_dir/submission.json"+ jq -e '.status == "Accepted"' "$credentials_dir/submission.json" > /dev/null+ xcrun stapler staple "$dmg"+ xcrun stapler validate "$dmg"+ spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"++ # Stapling changes the DMG bytes, so checksum the final distributable.(cd artifacts && shasum -a 256 -- *.dmg > macro-dmg-SHA256SUMS)shell: bash+ env:+ DOPPLER_TOKEN: ${{ secrets.MACOS_RELEASE_DOPPLER_TOKEN }}- name: Upload macro-dmg-${{ steps.metadata.outputs.safe_tag }} artifactuses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02with:diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rsindex 9ab469e5ec..21a866905a 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/build_dmg_on_tag.rs@@ -39,6 +39,7 @@ pub fn build_dmg_job(ref_expr: &str) -> Job {.add_step(nix_build_dmg()).add_step(collect_dmg()).add_step(validate_signed_dmg())+ .add_step(notarize_dmg()).add_step(steps::upload_artifact("macro-dmg-${{ steps.metadata.outputs.safe_tag }}",xtask_paths::runtime_path!("artifacts/*"),@@ -92,3 +93,10 @@ fn validate_signed_dmg() -> Step<Run> {.run(include_str!("scripts/validate_signed_dmg.sh")).shell("bash")}++fn notarize_dmg() -> Step<Run> {+ Step::new("Notarize and staple DMG")+ .run(include_str!("scripts/notarize_dmg.sh"))+ .shell("bash")+ .add_env(("DOPPLER_TOKEN", vars::MACOS_RELEASE_DOPPLER_TOKEN))+}diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.shnew file mode 100644index 0000000000..37e6409216--- /dev/null+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.sh@@ -0,0 +1,36 @@+set -euo pipefail++if [ -z "${DOPPLER_TOKEN:-}" ]; then+ echo "MACOS_RELEASE_DOPPLER_TOKEN must grant read access to macos-release/prd" >&2+ exit 1+fi+dmg=$(find artifacts -maxdepth 1 -type f -name '*.dmg' -print -quit)+if [ -z "$dmg" ]; then+ echo "No DMG found to notarize" >&2+ exit 1+fi++umask 077+credentials_dir=$(mktemp -d)+trap 'rm -rf "$credentials_dir"' EXIT+curl --fail --silent --show-error --retry 3 \+ --header "Authorization: Bearer $DOPPLER_TOKEN" \+ 'https://api.doppler.com/v3/configs/config/secrets/download?project=macos-release&config=prd&format=json&secrets=APPLE_API_PRIVATE_KEY,APPLE_API_KEY_ID,APPLE_API_ISSUER' \+ > "$credentials_dir/secrets.json"+jq -er '.APPLE_API_PRIVATE_KEY | strings | select(length > 0)' \+ "$credentials_dir/secrets.json" > "$credentials_dir/AuthKey.p8"+key_id=$(jq -er '.APPLE_API_KEY_ID | strings | select(length > 0)' "$credentials_dir/secrets.json")+issuer=$(jq -er '.APPLE_API_ISSUER | strings | select(length > 0)' "$credentials_dir/secrets.json")++# Submission failure, rejection, or timeout must prevent publishing this build.+xcrun notarytool submit "$dmg" \+ --key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \+ --wait --timeout 30m --output-format json > "$credentials_dir/submission.json"+cat "$credentials_dir/submission.json"+jq -e '.status == "Accepted"' "$credentials_dir/submission.json" > /dev/null+xcrun stapler staple "$dmg"+xcrun stapler validate "$dmg"+spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"++# Stapling changes the DMG bytes, so checksum the final distributable.+(cd artifacts && shasum -a 256 -- *.dmg > macro-dmg-SHA256SUMS)diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.shindex 52b2dca033..994077942c 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.sh+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/validate_signed_dmg.sh@@ -35,5 +35,3 @@ if [ -s "$dylib_refs" ]; thencat "$dylib_refs" >&2exit 1fi--(cd artifacts && shasum -a 256 -- *.dmg > macro-dmg-SHA256SUMS)diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rsindex 49bf188de3..76daf86c2e 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs@@ -21,6 +21,7 @@ secret!(DD_APP_KEY);secret!(DOPPLER_TOKEN);secret!(MACOS_DEVELOPER_ID_CERTIFICATE_BASE64);secret!(MACOS_DEVELOPER_ID_CERTIFICATE_PASSWORD);+secret!(MACOS_RELEASE_DOPPLER_TOKEN);secret!(NIX_CACHE_SIGNING_KEY);secret!(POSTHOG_API_KEY);secret!(PULUMI_ACCESS_TOKEN);