mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-08-29 03:12:10 +08:00
Fix Windows app release packaging
This commit is contained in:
@@ -205,9 +205,7 @@ jobs:
|
||||
- name: Build and publish Windows artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
npm run build:assets
|
||||
npx electron-builder --win --publish always
|
||||
run: npm run build:app:win:release -- --publish always
|
||||
|
||||
linux:
|
||||
name: Linux
|
||||
|
||||
@@ -222,6 +222,17 @@ docker compose up -d --build
|
||||
|
||||
Docker exposes the management UI and gateway routes through `http://127.0.0.1:3458` by default. Read the [Docker deployment guide](https://ccrdesk.top/en/guides/docker/) before exposing CCR remotely.
|
||||
|
||||
## Build desktop apps
|
||||
|
||||
Install Node.js 22+, then run `npm ci`.
|
||||
|
||||
| Target | Command | Output |
|
||||
| --- | --- | --- |
|
||||
| macOS local DMG/ZIP | `npm run build:app:mac` | `release-local/` |
|
||||
| Windows local NSIS installer | `npm run build:app:win` | `release-local/` |
|
||||
|
||||
Windows app packaging must run on Windows x64 because `better-sqlite3` ships a native Electron module. The release workflow builds macOS on macOS runners and Windows on `windows-latest` when a `v*` tag is pushed.
|
||||
|
||||
## How it works
|
||||
|
||||
```text
|
||||
|
||||
@@ -222,6 +222,17 @@ docker compose up -d --build
|
||||
|
||||
Docker 默认通过 `http://127.0.0.1:3458` 提供管理界面与网关路由。远程暴露 CCR 前,请先阅读 [Docker 部署指南](https://ccrdesk.top/guides/docker/)。
|
||||
|
||||
## 构建桌面应用
|
||||
|
||||
先安装 Node.js 22+,然后执行 `npm ci`。
|
||||
|
||||
| 目标 | 命令 | 产物目录 |
|
||||
| --- | --- | --- |
|
||||
| macOS 本地 DMG/ZIP | `npm run build:app:mac` | `release-local/` |
|
||||
| Windows 本地 NSIS 安装包 | `npm run build:app:win` | `release-local/` |
|
||||
|
||||
Windows App 打包必须在 Windows x64 上运行,因为 `better-sqlite3` 包含 Electron 原生模块,不能从 macOS 或 Linux 交叉编译。推送 `v*` tag 时,release workflow 会分别在 macOS runner 和 `windows-latest` 上构建 macOS 与 Windows 产物。
|
||||
|
||||
## 工作方式
|
||||
|
||||
```text
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
const errors = [];
|
||||
|
||||
if (process.platform !== "win32") {
|
||||
errors.push(
|
||||
[
|
||||
"Windows app builds must run on Windows.",
|
||||
"This package includes better-sqlite3, and node-gyp cannot cross-compile its native Electron binary from macOS or Linux.",
|
||||
"Use a Windows x64 machine or the GitHub Actions Windows release job."
|
||||
].join(" ")
|
||||
);
|
||||
}
|
||||
|
||||
if (process.arch !== "x64") {
|
||||
errors.push(
|
||||
`Windows packaging is configured for x64 NSIS artifacts, but this Node.js process is ${process.arch}. Run the build with x64 Node.js on Windows.`
|
||||
);
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
console.error("Windows packaging preflight failed:");
|
||||
for (const error of errors) {
|
||||
console.error(`- ${error}`);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("Windows packaging preflight passed.");
|
||||
+3
-1
@@ -40,7 +40,9 @@
|
||||
"build:app:mac": "npm run build:app:mac:local",
|
||||
"build:app:mac:local": "npm run build:assets && electron-builder --config build/electron-builder.local.cjs --mac --publish never",
|
||||
"build:app:mac:release": "node build/macos-release-preflight.mjs && npm run models:update && npm run build:assets && electron-builder --mac --publish never",
|
||||
"build:app:win": "npm run build:assets && electron-builder --win",
|
||||
"build:app:win": "npm run build:app:win:local",
|
||||
"build:app:win:local": "node build/windows-package-preflight.mjs && npm run build:assets && electron-builder --config build/electron-builder.local.cjs --win --publish never",
|
||||
"build:app:win:release": "node build/windows-package-preflight.mjs && npm run build:assets && electron-builder --win",
|
||||
"models:update": "node scripts/generate-models-json.mjs",
|
||||
"prepack": "npm run models:update && npm run build:assets",
|
||||
"prepublishOnly": "npm run typecheck",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "3.0.16",
|
||||
"private": true,
|
||||
"description": "Claude Code Router Electron desktop shell.",
|
||||
"author": "musistudio",
|
||||
"main": "dist/main/main.js",
|
||||
"scripts": {
|
||||
"test": "node ../../build/test.mjs electron && node ../../build/run-tests.mjs electron",
|
||||
|
||||
Reference in New Issue
Block a user