mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
* ci(release): optimize validation steps * fix(ci): address release validation review comments * fix(ci): document prepare skip contract * test(ci): cover prepare failure exit * fix(ci): prefix prepare error logs * fix(ci): keep release quality build artifacts * fix(ci): address release validation comments * fix(ci): preserve release publish hooks * test(ci): cover prepare failure paths * fix(ci): disable release coverage safely
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2026 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { spawnSync } from 'node:child_process';
|
|
|
|
// Release workflow jobs set this when they run explicit build/bundle steps after
|
|
// npm ci. Workflows that rely on prepare-during-install should leave it unset.
|
|
const skipPrepare = ['1', 'true'].includes(
|
|
(process.env.QWEN_SKIP_PREPARE ?? '').toLowerCase(),
|
|
);
|
|
|
|
if (skipPrepare) {
|
|
console.log('Skipping prepare because QWEN_SKIP_PREPARE is set.');
|
|
process.exit(0);
|
|
}
|
|
|
|
run('husky');
|
|
run('npm', ['run', 'build']);
|
|
run('npm', ['run', 'bundle']);
|
|
|
|
function run(command, args = []) {
|
|
const result = spawnSync(command, args, {
|
|
shell: process.platform === 'win32',
|
|
stdio: 'inherit',
|
|
});
|
|
|
|
const label = args.length ? `${command} ${args.join(' ')}` : command;
|
|
|
|
if (result.error) {
|
|
console.error(`prepare: ${label} failed: ${result.error.message}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
if (result.signal) {
|
|
console.error(`prepare: ${label} killed by signal ${result.signal}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
if (result.status !== 0) {
|
|
console.error(`prepare: ${label} exited with status ${result.status}`);
|
|
process.exit(result.status ?? 1);
|
|
}
|
|
}
|