Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

feat: notarize cursor motion releases

Leoa55f1521ecc1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d04f5b7..6764a07 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -121,6 +121,43 @@ jobs:
- name: Make DMG build script executable
run: chmod +x ./scripts/build-cursor-motion-dmg.sh
+ - name: Prepare Cursor Motion signing config
+ env:
+ OPEN_COMPUTER_USE_CODESIGN_P12_BASE64: ${{ secrets.OPEN_COMPUTER_USE_CODESIGN_P12_BASE64 }}
+ OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD: ${{ secrets.OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD }}
+ OPEN_COMPUTER_USE_CODESIGN_KEYCHAIN_PASSWORD: ${{ secrets.OPEN_COMPUTER_USE_CODESIGN_KEYCHAIN_PASSWORD }}
+ run: |
+ echo "CURSOR_MOTION_CODESIGN_MODE=adhoc" >> "${GITHUB_ENV}"
+
+ if [ -z "${OPEN_COMPUTER_USE_CODESIGN_P12_BASE64}" ] || [ -z "${OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD}" ]; then
+ echo "No Developer ID signing certificate configured; Cursor Motion DMG will be ad-hoc signed and notarization will be skipped."
+ exit 0
+ fi
+
+ keychain_password="${OPEN_COMPUTER_USE_CODESIGN_KEYCHAIN_PASSWORD:-${RUNNER_TEMP}-cursor-motion-keychain}"
+ cert_path="${RUNNER_TEMP}/cursor-motion-signing.p12"
+ keychain_path="${RUNNER_TEMP}/cursor-motion-signing.keychain-db"
+
+ CERT_PATH="${cert_path}" python3 -c 'import base64, os, pathlib; pathlib.Path(os.environ["CERT_PATH"]).write_bytes(base64.b64decode(os.environ["OPEN_COMPUTER_USE_CODESIGN_P12_BASE64"]))'
+
+ security create-keychain -p "${keychain_password}" "${keychain_path}"
+ security set-keychain-settings -lut 21600 "${keychain_path}"
+ security unlock-keychain -p "${keychain_password}" "${keychain_path}"
+ security import "${cert_path}" -k "${keychain_path}" -P "${OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD}" -T /usr/bin/codesign -T /usr/bin/security
+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${keychain_password}" "${keychain_path}"
+
+ resolved_identity="$(security find-identity -v -p codesigning "${keychain_path}" | sed -n 's/.*\"\\(.*\\)\"/\\1/p' | head -n 1)"
+ if [ -z "${resolved_identity}" ]; then
+ echo "Imported signing certificate, but no usable codesigning identity was found in ${keychain_path}." >&2
+ exit 1
+ fi
+
+ {
+ echo "CURSOR_MOTION_CODESIGN_MODE=identity"
+ echo "CURSOR_MOTION_CODESIGN_IDENTITY=${resolved_identity}"
+ echo "CURSOR_MOTION_CODESIGN_KEYCHAIN=${keychain_path}"
+ } >> "${GITHUB_ENV}"
+
- name: Build Cursor Motion DMG
env:
RELEASE_TAG: ${{ github.ref_name }}
@@ -131,6 +168,34 @@ jobs:
--arch universal \
--version "${version}"
+ - name: Notarize Cursor Motion DMG
+ env:
+ RELEASE_TAG: ${{ github.ref_name }}
+ APPLE_NOTARY_API_KEY_P8_BASE64: ${{ secrets.APPLE_NOTARY_API_KEY_P8_BASE64 }}
+ APPLE_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
+ APPLE_NOTARY_ISSUER_ID: ${{ secrets.APPLE_NOTARY_ISSUER_ID }}
+ APPLE_DEVELOPER_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
+ run: |
+ if [ -z "${APPLE_NOTARY_API_KEY_P8_BASE64}" ] || [ -z "${APPLE_NOTARY_KEY_ID}" ] || [ -z "${APPLE_NOTARY_ISSUER_ID}" ] || [ -z "${APPLE_DEVELOPER_TEAM_ID}" ]; then
+ echo "No notary credentials configured; skipping Cursor Motion notarization."
+ exit 0
+ fi
+
+ version="${RELEASE_TAG#v}"
+ dmg_path="dist/release/cursor-motion/CursorMotion-${version}.dmg"
+ api_key_path="${RUNNER_TEMP}/AuthKey_${APPLE_NOTARY_KEY_ID}.p8"
+
+ CERT_PATH="${api_key_path}" python3 -c 'import base64, os, pathlib; pathlib.Path(os.environ["CERT_PATH"]).write_bytes(base64.b64decode(os.environ["APPLE_NOTARY_API_KEY_P8_BASE64"]))'
+
+ xcrun notarytool submit "${dmg_path}" \
+ --key "${api_key_path}" \
+ --key-id "${APPLE_NOTARY_KEY_ID}" \
+ --issuer "${APPLE_NOTARY_ISSUER_ID}" \
+ --team-id "${APPLE_DEVELOPER_TEAM_ID}" \
+ --wait
+
+ xcrun stapler staple "${dmg_path}"
+
- name: Upload Cursor Motion release artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
diff --git a/docs/CICD.md b/docs/CICD.md
index f6518b4..8d093a0 100644
--- a/docs/CICD.md
+++ b/docs/CICD.md
@@ -6,7 +6,7 @@
- `scripts/release-package.sh`:构建 universal `Open Computer Use.app`,stage 三个 npm 包目录,并产出 `dist/release/npm/*.tgz` 与 `dist/release/release-manifest.json`。当前 CI 继续显式使用 ad-hoc signing,保持和此前发布链路一致;本地 debug/dev 构建则允许使用开发机自己的签名身份。
- `scripts/build-cursor-motion-dmg.sh`:本地构建 `Cursor Motion.app` 并封装 `dist/release/cursor-motion/CursorMotion-<version>.dmg`,支持 `native` / `arm64` / `x86_64` / `universal`。
-- `.github/workflows/release.yml`:支持 push semver tag 自动发布,也支持手动触发;tag push 时会同时跑 npm release 打包逻辑与 `Cursor Motion` 的 DMG 打包,并把 `.dmg` 上传到对应的 GitHub Releases 页面。`Open Computer Use` 的 npm 产物默认走 ad-hoc signing;如果配置了 `OPEN_COMPUTER_USE_CODESIGN_*` secrets,则会先导入 `Developer ID Application` 证书,再按同一 identity 对 release `.app` 统一签名。当前 `Cursor Motion` 这条链路仍只做 ad-hoc codesign,不包含 notarization。
+- `.github/workflows/release.yml`:支持 push semver tag 自动发布,也支持手动触发;tag push 时会同时跑 npm release 打包逻辑与 `Cursor Motion` 的 DMG 打包,并把 `.dmg` 上传到对应的 GitHub Releases 页面。`Open Computer Use` 的 npm 产物默认走 ad-hoc signing;如果配置了 `OPEN_COMPUTER_USE_CODESIGN_*` secrets,则会先导入 `Developer ID Application` 证书,再按同一 identity 对 release `.app` 统一签名。`Cursor Motion` 的 DMG 也会复用同一张 `Developer ID Application` 证书签 app;若同时配置 `APPLE_NOTARY_*` secrets,则会在上传前对 `.dmg` 做 notarization 和 staple。
## 设计原则
diff --git a/docs/histories/2026-04/20260420-1758-enable-cursor-motion-notarization.md b/docs/histories/2026-04/20260420-1758-enable-cursor-motion-notarization.md
new file mode 100644
index 0000000..cbe5242
--- /dev/null
+++ b/docs/histories/2026-04/20260420-1758-enable-cursor-motion-notarization.md
@@ -0,0 +1,28 @@
+## [2026-04-20 17:58] | Task: 接通 Cursor Motion 的 Developer ID 签名与 notarization
+
+### 🤖 Execution Context
+* **Agent ID**: `codex`
+* **Base Model**: `gpt-5.4`
+* **Runtime**: `Codex CLI on macOS`
+
+### 📥 User Query
+> gh 已经有权限的,你可以配置,还需要我提供什么 secret 么?还是你都可以拿到
+
+### 🛠 Changes Overview
+**Scope:** `.github/workflows/`、`docs/`、`scripts/`
+
+**Key Actions:**
+- **[Repo Secrets Installed]**: 将 `Developer ID Application` 证书 `.p12`、密码、identity,以及 notarization 需要的 Team API key、Key ID、Issuer ID、Team ID 写入 GitHub repo secrets。
+- **[Cursor Motion Signing]**: `scripts/build-cursor-motion-dmg.sh` 新增 `CURSOR_MOTION_CODESIGN_*` 环境变量支持,允许在构建 `Cursor Motion.app` 时用 `Developer ID Application` 证书签名,而不是固定 ad-hoc。
+- **[Cursor Motion Notarization]**: release workflow 的 `release-cursor-motion-dmg` job 现在会在检测到 `APPLE_NOTARY_*` secrets 后,使用 `xcrun notarytool submit --wait` 对生成的 `.dmg` 执行 notarization,并在成功后 `stapler staple`。
+- **[Fallback Safety]**: 缺失 signing 或 notary secrets 时,workflow 会明确打印降级原因,但不会阻塞 release。
+
+### 🧠 Design Intent (Why)
+在 `Developer ID Application` 证书与 App Store Connect Team API key 都已齐备的情况下,仅仅把 secret 存进 GitHub 还不够;真正影响用户体验的是 `Cursor Motion` 下载物本身是否已经过 `Developer ID` 签名和 Apple notarization。把这条链路放进 workflow 后,tag release 才能稳定产出更接近标准 macOS 分发体验的 `.dmg`。
+
+### 📁 Files Modified
+- `scripts/build-cursor-motion-dmg.sh`
+- `.github/workflows/release.yml`
+- `docs/CICD.md`
+- `docs/releases/RELEASE_GUIDE.md`
+- `docs/histories/2026-04/20260420-1758-enable-cursor-motion-notarization.md`
diff --git a/docs/releases/RELEASE_GUIDE.md b/docs/releases/RELEASE_GUIDE.md
index 558208e..a98c820 100644
--- a/docs/releases/RELEASE_GUIDE.md
+++ b/docs/releases/RELEASE_GUIDE.md
@@ -114,8 +114,8 @@ gh run view -R iFurySt/open-codex-computer-use <run-id> --log-failed
## 当前已知边界
- `Open Computer Use` 的 npm release 产物在没有配置 `OPEN_COMPUTER_USE_CODESIGN_P12_BASE64` / `OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD` 等 secrets 时,仍会退回 ad-hoc signing;配置后会先导入 `Developer ID Application` 证书,再按该 identity 统一签名。
-- `Cursor Motion` 当前 release 资产仍只做 ad-hoc codesign,不包含 Apple Developer ID 签名和 notarization。
-- 如果后续要把下载体验收口成更标准的 macOS 分发流程,还需要继续补 notarization 和对应 App Store Connect API key 流程。
+- `Cursor Motion` 当前 release 资产会优先复用 `OPEN_COMPUTER_USE_CODESIGN_*` 对 app 做 `Developer ID Application` 签名;如果同时配置 `APPLE_NOTARY_API_KEY_P8_BASE64`、`APPLE_NOTARY_KEY_ID`、`APPLE_NOTARY_ISSUER_ID`、`APPLE_DEVELOPER_TEAM_ID`,workflow 会继续对 `.dmg` 执行 notarization 和 staple。
+- 如果上述 secrets 缺失,workflow 会分别退回 ad-hoc signing 或跳过 notarization,而不是阻塞整条 release。
## 如果 tag 已经打错了
diff --git a/scripts/build-cursor-motion-dmg.sh b/scripts/build-cursor-motion-dmg.sh
index 0525bb2..ad1fa79 100755
--- a/scripts/build-cursor-motion-dmg.sh
+++ b/scripts/build-cursor-motion-dmg.sh
@@ -7,6 +7,9 @@ configuration="release"
arch_mode="native"
version=""
output_dir=""
+codesign_mode="${CURSOR_MOTION_CODESIGN_MODE:-adhoc}"
+codesign_identity="${CURSOR_MOTION_CODESIGN_IDENTITY:-}"
+codesign_keychain="${CURSOR_MOTION_CODESIGN_KEYCHAIN:-}"
usage() {
cat <<'EOF'
@@ -15,6 +18,11 @@ Usage: ./scripts/build-cursor-motion-dmg.sh [--configuration debug|release] [--a
Examples:
./scripts/build-cursor-motion-dmg.sh
./scripts/build-cursor-motion-dmg.sh --configuration release --arch universal --version 0.1.0
+
+Environment:
+ CURSOR_MOTION_CODESIGN_MODE=identity|adhoc|none
+ CURSOR_MOTION_CODESIGN_IDENTITY="Developer ID Application: Example, Inc. (TEAMID)"
+ CURSOR_MOTION_CODESIGN_KEYCHAIN=/path/to/signing.keychain-db
EOF
}
@@ -74,6 +82,11 @@ if [[ "${arch_mode}" != "native" && "${arch_mode}" != "arm64" && "${arch_mode}"
exit 1
fi
+if [[ "${codesign_mode}" != "identity" && "${codesign_mode}" != "adhoc" && "${codesign_mode}" != "none" ]]; then
+ echo "Unsupported CURSOR_MOTION_CODESIGN_MODE: ${codesign_mode}" >&2
+ exit 1
+fi
+
if [[ -z "${version}" ]]; then
if tag="$(git -C "${repo_root}" describe --tags --exact-match 2>/dev/null)"; then
version="${tag#v}"
@@ -105,6 +118,94 @@ build_binary() {
printf '%s/CursorMotion\n' "${binary_dir}"
}
+list_user_keychains() {
+ security list-keychains -d user \
+ | sed -n 's/^[[:space:]]*"\(.*\)"$/\1/p'
+}
+
+run_with_codesign_keychain() {
+ local keychain_path="${1:-}"
+ shift
+
+ if [[ -z "${keychain_path}" ]]; then
+ "$@"
+ return
+ fi
+
+ local -a existing_keychains=()
+ while IFS= read -r keychain; do
+ if [[ -n "${keychain}" ]]; then
+ existing_keychains+=("${keychain}")
+ fi
+ done < <(list_user_keychains)
+
+ local -a desired_keychains=("${keychain_path}")
+ local existing=""
+ for existing in "${existing_keychains[@]}"; do
+ if [[ "${existing}" != "${keychain_path}" ]]; then
+ desired_keychains+=("${existing}")
+ fi
+ done
+
+ security list-keychains -d user -s "${desired_keychains[@]}" >/dev/null
+
+ local status=0
+ "$@" || status=$?
+
+ if [[ ${#existing_keychains[@]} -gt 0 ]]; then
+ security list-keychains -d user -s "${existing_keychains[@]}" >/dev/null
+ else
+ security list-keychains -d user -s >/dev/null
+ fi
+
+ return "${status}"
+}
+
+resolve_codesign_identity() {
+ case "${codesign_mode}" in
+ none)
+ return 1
+ ;;
+ adhoc)
+ printf '%s\n' "-"
+ return 0
+ ;;
+ identity)
+ if [[ -z "${codesign_identity}" ]]; then
+ echo "CURSOR_MOTION_CODESIGN_IDENTITY is required when CURSOR_MOTION_CODESIGN_MODE=identity" >&2
+ exit 1
+ fi
+ printf '%s\n' "${codesign_identity}"
+ return 0
+ ;;
+ esac
+}
+
+codesign_app_bundle() {
+ local app_path="${1:-}"
+ local identity=""
+
+ if ! identity="$(resolve_codesign_identity)"; then
+ echo "Skipping codesign for ${app_path} (CURSOR_MOTION_CODESIGN_MODE=none)" >&2
+ return
+ fi
+
+ local -a args=(--force --deep --sign "${identity}")
+
+ if [[ -n "${codesign_keychain}" && "${identity}" != "-" ]]; then
+ args+=(--keychain "${codesign_keychain}")
+ fi
+
+ run_with_codesign_keychain "${codesign_keychain}" \
+ codesign "${args[@]}" "${app_path}" >/dev/null
+
+ if [[ "${identity}" == "-" ]]; then
+ echo "Signed ${app_path} with ad-hoc identity." >&2
+ else
+ echo "Signed ${app_path} with ${identity}" >&2
+ fi
+}
+
app_name="Cursor Motion.app"
bundle_identifier="com.ifuryst.cursormotion"
bundle_version="${CURSOR_MOTION_BUNDLE_VERSION:-${GITHUB_RUN_NUMBER:-$(git -C "${repo_root}" rev-list --count HEAD 2>/dev/null || echo 1)}}"
@@ -204,7 +305,7 @@ cat > "${contents_dir}/Info.plist" <<PLIST
PLIST
plutil -lint "${contents_dir}/Info.plist" >/dev/null
-codesign --force --deep --sign - "${app_root}" >/dev/null 2>&1 || true
+codesign_app_bundle "${app_root}"
cp -R "${app_root}" "${dmg_root}/"
ln -s /Applications "${dmg_root}/Applications"