固定 AGC Windows x64 发布目标
构建默认使用 x86_64-pc-windows-msvc 更新清单只扫描 Windows NSIS 安装包 同步构建产物目录说明
This commit is contained in:
@@ -5,10 +5,14 @@ import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const appRoot = fileURLToPath(new URL('..', import.meta.url));
|
||||
const defaultReleaseTarget = 'x86_64-pc-windows-msvc';
|
||||
const releaseTarget =
|
||||
process.env.AGC_BUILD_TARGET?.trim() || defaultReleaseTarget;
|
||||
const bundleRoot = path.join(
|
||||
appRoot,
|
||||
'src-tauri',
|
||||
'target',
|
||||
releaseTarget,
|
||||
'release',
|
||||
'bundle',
|
||||
);
|
||||
@@ -19,9 +23,21 @@ const defaultOssBaseUrl =
|
||||
'https://agc-dev.oss-rg-china-mainland.aliyuncs.com/agc';
|
||||
|
||||
function runTauriBuild(args) {
|
||||
const noBundle = args.includes('--no-bundle');
|
||||
const hasTarget = args.includes('--target');
|
||||
const targetArgs = noBundle || hasTarget ? [] : ['--target', releaseTarget];
|
||||
const result = spawnSync(
|
||||
'npm',
|
||||
['--prefix', '../..', 'exec', 'tauri', '--', 'build', ...args],
|
||||
[
|
||||
'--prefix',
|
||||
'../..',
|
||||
'exec',
|
||||
'tauri',
|
||||
'--',
|
||||
'build',
|
||||
...targetArgs,
|
||||
...args,
|
||||
],
|
||||
{ cwd: appRoot, stdio: 'inherit' },
|
||||
);
|
||||
if (result.error) throw result.error;
|
||||
@@ -38,7 +54,7 @@ function listFiles(root) {
|
||||
|
||||
function artifactPriority(filePath) {
|
||||
const name = path.basename(filePath).toLowerCase();
|
||||
if (process.platform === 'win32') return name.endsWith('.exe') ? 0 : 99;
|
||||
if (releaseTarget.includes('windows')) return name.endsWith('.exe') ? 0 : 99;
|
||||
if (process.platform === 'darwin') return name.endsWith('.dmg') ? 0 : 99;
|
||||
if (name.endsWith('.appimage')) return 0;
|
||||
if (name.endsWith('.deb')) return 1;
|
||||
|
||||
@@ -29,6 +29,6 @@ AGC 每次启动时由根窗口检查一次公开 OSS 更新清单。清单默
|
||||
|
||||
## 发布约定
|
||||
|
||||
执行 `npm run ai-game-creator-shell:build` 会在 Tauri 构建完成后自动扫描平台安装包,并在 `apps/ai-game-creator-shell/src-tauri/target/release/bundle/latest.json` 生成包含版本、下载地址、大小和 SHA-256 的清单。可通过 `AGC_UPDATE_ARTIFACT` 指定要发布的安装包,通过 `AGC_UPDATE_OSS_BASE_URL` 指定 OSS 前缀,通过 `AGC_UPDATE_RELEASE_NOTES` 写入发布说明;`--no-bundle` smoke 构建不会生成清单。
|
||||
当前发布目标固定为 Windows x64 NSIS。执行 `npm run ai-game-creator-shell:build` 会向 Tauri 传入 `--target x86_64-pc-windows-msvc`,在构建完成后自动扫描 `.exe` 安装包,并在 `apps/ai-game-creator-shell/src-tauri/target/x86_64-pc-windows-msvc/release/bundle/latest.json` 生成包含版本、下载地址、大小和 SHA-256 的清单。可通过 `AGC_BUILD_TARGET` 显式覆盖目标(发布仍应使用 Windows x64),通过 `AGC_UPDATE_ARTIFACT` 指定要发布的安装包,通过 `AGC_UPDATE_OSS_BASE_URL` 指定 OSS 前缀,通过 `AGC_UPDATE_RELEASE_NOTES` 写入发布说明;`--no-bundle` smoke 构建不会生成清单。
|
||||
|
||||
每次发布安装包上传完成后,再上传同一目录生成的 `latest.json`,确保 `downloadUrl` 指向已存在的 OSS 对象;清单和安装包均使用公开可读对象,不在清单中保存凭据、签名或本地路径。构建脚本不自动上传 OSS,避免把 AccessKey 写入本地配置或 CI 日志。
|
||||
|
||||
Reference in New Issue
Block a user