mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
3693f7dacb
Replace tools/release.mjs with two workflow_dispatch flows: - stable: production environment gate (Required Reviewers) + lightweight git tag. Trusted Publishing (OIDC) removes the need for an npm token. - channel beta: disposable 0.0.0-beta-<sha>-<date> versions on the corresponding dist-tag, no tag, no commit. Any collaborator can dispatch without npm credentials. Pack-time scans via publint, attw, gitleaks; weekly Dependabot for npm + actions.
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
import { fileURLToPath } from "url";
|
|
|
|
import { packAndScan } from "./lib/pack-scan.mjs";
|
|
import { run } from "./lib/proc.mjs";
|
|
import { assertReadmeSync, loadAndValidatePackages } from "./lib/validate.mjs";
|
|
|
|
function log(msg = "") {
|
|
process.stdout.write(`${msg}\n`);
|
|
}
|
|
|
|
function step(msg) {
|
|
log(`\n==> ${msg}`);
|
|
}
|
|
|
|
/**
|
|
* Pure-validation pipeline. Reusable from publish-stable / publish-channel.
|
|
* Returns { coreJson, cliJson } for callers that need the parsed package.jsons.
|
|
*/
|
|
export async function runCheck() {
|
|
step("pnpm install --frozen-lockfile");
|
|
run("pnpm", ["install", "--frozen-lockfile"]);
|
|
|
|
step("metadata: README sync, version consistency, workspace:* dep");
|
|
assertReadmeSync();
|
|
const { coreJson, cliJson } = loadAndValidatePackages();
|
|
log(`bailian-cli-core@${coreJson.version}`);
|
|
log(`bailian-cli@${cliJson.version}`);
|
|
|
|
step("build bailian-cli-core");
|
|
run("pnpm", ["--filter", "bailian-cli-core", "run", "build"]);
|
|
|
|
step("build bailian-cli");
|
|
run("pnpm", ["--filter", "bailian-cli", "run", "build"]);
|
|
|
|
step("pack + scan (publint, attw, gitleaks)");
|
|
packAndScan({ log });
|
|
|
|
log("\nrelease check passed.");
|
|
return { coreJson, cliJson };
|
|
}
|
|
|
|
const invokedDirectly = process.argv[1] === fileURLToPath(import.meta.url);
|
|
if (invokedDirectly) {
|
|
try {
|
|
await runCheck();
|
|
} catch (error) {
|
|
process.stderr.write(`\nrelease check failed: ${error.message}\n`);
|
|
process.exit(1);
|
|
}
|
|
}
|