feat(auto-update): 实现全流程自动更新功能与配套界面

- 新增主进程更新服务,支持GitHub官方源与加速源兜底的检查、下载、安装全流程
- 新增独立更新日志页面,支持查看更新说明与更新全流程管理
- 实现更新状态持久化,重启应用可恢复上次未完成的下载进度
- 完善版本管理与构建元数据脚本,优化CI发布流水线
- 补充VersionCard的构建信息展示与更新页跳转逻辑
- 新增更新相关IPC接口、类型定义与全局状态管理
- 清理旧的无用配置项,升级相关依赖包
This commit is contained in:
2026-08-30 20:19:15 +08:00
parent b404ffaef8
commit 4d3e43394c
26 changed files with 2280 additions and 98 deletions
+34
View File
@@ -0,0 +1,34 @@
/**
* 生成构建元数据文件 src/lib/buildInfo.tsCI 构建时调用)。
*
* 用法:
* node scripts/gen-build-info.js <mode> # mode: dev | beta | run
*
* 环境变量:
* BUILD_ID 编译号(CI 传 GITHUB_RUN_NUMBER;缺省 "local"
* 本地 git HEAD 短哈希作为构建来源 commit。
*/
'use strict';
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const mode = process.argv[2] || 'run';
let commit = '';
try {
commit = execSync('git rev-parse --short HEAD').toString().trim();
} catch {
/* 非 git 环境,保持空 */
}
const buildId = process.env.BUILD_ID || process.env.GITHUB_RUN_NUMBER || 'local';
const content = `// 构建元数据:由 scripts/gen-build-info.js 自动生成(CI 覆盖;本地开发为默认值)
export const BUILD_COMMIT: string = ${JSON.stringify(commit)};
export const BUILD_ID: string = ${JSON.stringify(buildId)};
`;
fs.writeFileSync(path.join(__dirname, '..', 'src', 'lib', 'buildInfo.ts'), content);
console.log(`[build-info] mode=${mode} commit=${commit || '(none)'} buildId=${buildId}`);