From ce620f1b537ed58c562999f576a7e9d521dfd072 Mon Sep 17 00:00:00 2001 From: Zyy <0x@ainz.cc> Date: Sun, 8 Nov 2026 17:30:22 +0800 Subject: [PATCH] feat(release): add Intel macOS downloads (#641) Co-authored-by: Zyy Co-authored-by: Codex --- README.md | 3 +- .../src/use_case/plugins/official.rs | 9 +++- .../tests/use_case/plugins/official.rs | 48 +++++++++++-------- deploy/README.md | 2 +- release/platforms.yaml | 7 +++ 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 234f61aeb..27f09a01a 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ 以下命令适用于 Linux amd64/arm64,需要 Docker Engine、Docker Compose Plugin、curl 和 OpenSSL -Windows x64 / ARM64 使用发行包部署,步骤见 [Windows 二进制部署](deploy/README.md#windows-二进制部署) +macOS 从[发行页](https://github.com/zyycn/codex-proxy-rs/releases)下载对应的归档:Intel 机型选 `darwin_amd64`,Apple Silicon 机型选 `darwin_arm64`。 +Windows x64 / ARM64 的安装步骤见 [Windows 二进制部署](deploy/README.md#windows-二进制部署) 已有部署请先看 [升级说明](deploy/README.md#镜像升级与源码构建),不要覆盖原配置 diff --git a/backend/crates/gateway-admin/src/use_case/plugins/official.rs b/backend/crates/gateway-admin/src/use_case/plugins/official.rs index 806858398..59867ede5 100644 --- a/backend/crates/gateway-admin/src/use_case/plugins/official.rs +++ b/backend/crates/gateway-admin/src/use_case/plugins/official.rs @@ -365,7 +365,7 @@ fn current_platform() -> Option { fn target_environment_matches(target: &str) -> bool { match target { "x86_64-unknown-linux-gnu" | "aarch64-unknown-linux-gnu" => cfg!(target_env = "gnu"), - "aarch64-apple-darwin" => cfg!(target_os = "macos"), + "x86_64-apple-darwin" | "aarch64-apple-darwin" => cfg!(target_os = "macos"), "x86_64-pc-windows-msvc" | "aarch64-pc-windows-msvc" => cfg!(target_env = "msvc"), _ => false, } @@ -386,6 +386,13 @@ const SUPPORTED_PLATFORMS: &[Platform] = &[ runtime_os: "linux", runtime_architecture: "aarch64", }, + Platform { + release_os: "darwin", + release_architecture: "amd64", + target: "x86_64-apple-darwin", + runtime_os: "macos", + runtime_architecture: "x86_64", + }, Platform { release_os: "darwin", release_architecture: "arm64", diff --git a/backend/crates/gateway-admin/tests/use_case/plugins/official.rs b/backend/crates/gateway-admin/tests/use_case/plugins/official.rs index 2f2924db0..40643c081 100644 --- a/backend/crates/gateway-admin/tests/use_case/plugins/official.rs +++ b/backend/crates/gateway-admin/tests/use_case/plugins/official.rs @@ -423,31 +423,37 @@ fn system_context() -> MutationContext { } fn plugin_entry(id: &str, marker: u8) -> serde_json::Value { - let (release_os, release_architecture, target) = release_platform(); + // 清单列出所有平台,夹具只提供本机归档,以验证导入时不会读取其他平台的包 + let artifacts = [ + ("linux", "amd64", "x86_64-unknown-linux-gnu"), + ("linux", "arm64", "aarch64-unknown-linux-gnu"), + ("darwin", "amd64", "x86_64-apple-darwin"), + ("darwin", "arm64", "aarch64-apple-darwin"), + ("windows", "amd64", "x86_64-pc-windows-msvc"), + ("windows", "arm64", "aarch64-pc-windows-msvc"), + ] + .map(|(release_os, release_architecture, target)| { + let os = if release_os == "darwin" { + "macos" + } else { + release_os + }; + let (architecture, _) = target.split_once('-').unwrap(); + serde_json::json!({ + "release_os": release_os, + "release_architecture": release_architecture, + "target": target, + "os": os, + "architecture": architecture, + "archive": format!("{id}-1.0.0-{os}-{architecture}.tar.gz"), + "sha256": format!("{marker:01x}").repeat(64), + }) + }); serde_json::json!({ "id": id, "version": "1.0.0", "publisher": "test", "stability": "experimental", - "artifacts": [{ - "release_os": release_os, - "release_architecture": release_architecture, - "target": target, - "os": std::env::consts::OS, - "architecture": std::env::consts::ARCH, - "archive": format!("{id}-1.0.0-{}-{}.tar.gz", std::env::consts::OS, std::env::consts::ARCH), - "sha256": format!("{marker:01x}").repeat(64), - }] + "artifacts": artifacts, }) } - -fn release_platform() -> (&'static str, &'static str, &'static str) { - match (std::env::consts::OS, std::env::consts::ARCH) { - ("linux", "x86_64") => ("linux", "amd64", "x86_64-unknown-linux-gnu"), - ("linux", "aarch64") => ("linux", "arm64", "aarch64-unknown-linux-gnu"), - ("macos", "aarch64") => ("darwin", "arm64", "aarch64-apple-darwin"), - ("windows", "x86_64") => ("windows", "amd64", "x86_64-pc-windows-msvc"), - ("windows", "aarch64") => ("windows", "arm64", "aarch64-pc-windows-msvc"), - platform => panic!("unsupported test platform: {platform:?}"), - } -} diff --git a/deploy/README.md b/deploy/README.md index 718260ad3..c3b489a81 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -959,7 +959,7 @@ Release 必须提供当前 OS/架构的 `codex-proxy-rs___.ta 宿主范围或能力版本不匹配时,可在插件页确认风险后尝试本次启动;清单、RPC、平台或包完整性错误不能绕过。具体操作见[插件故障处理](../docs/plugins.md#故障处理) 部署须保留完整的二进制、Web 资源与官方插件目录;不要手动修改制品元数据或迁移 checksum 绕过校验。 -macOS arm64、Windows x64 / ARM64 提供构建产物;插件安装包必须匹配宿主 OS 和架构,部署前需验证目标平台的插件运行与上游调用,不能只以打包成功判断可用 +插件安装包必须匹配宿主 OS 和架构,部署前需验证目标平台的插件运行与上游调用,不能只以打包成功判断可用 ## 备份与恢复 diff --git a/release/platforms.yaml b/release/platforms.yaml index c8c96d19b..f38f2bc5c 100644 --- a/release/platforms.yaml +++ b/release/platforms.yaml @@ -17,6 +17,13 @@ platforms: docker: true dockerPlatform: linux/arm64 + - os: darwin + arch: amd64 + runner: macos-15-intel + target: x86_64-apple-darwin + binary: codex-proxy-rs + archive: tar.gz + - os: darwin arch: arm64 runner: macos-15