Files
modelstudioai__cli/tools/release/lib/proc.mjs
若麒 3693f7dacb feat(release): CI-driven publish pipeline via GitHub Actions + npm OIDC
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.
2026-06-04 23:02:38 +08:00

36 lines
1.1 KiB
JavaScript

import { spawnSync } from "child_process";
import { ROOT } from "./packages.mjs";
export function run(command, args, options = {}) {
const result = spawnSync(command, args, {
cwd: options.cwd ?? ROOT,
stdio: options.stdio ?? "inherit",
env: { ...process.env, ...options.env },
encoding: "utf-8",
});
if (result.status !== 0) {
const detail = result.stderr?.trim() || result.stdout?.trim();
throw new Error(`${command} ${args.join(" ")} failed${detail ? `\n${detail}` : ""}`);
}
return result.stdout ?? "";
}
export function runCapture(command, args, options = {}) {
return run(command, args, { ...options, stdio: ["ignore", "pipe", "pipe"] }).trim();
}
export function tryRun(command, args, options = {}) {
const result = spawnSync(command, args, {
cwd: options.cwd ?? ROOT,
stdio: options.stdio ?? ["ignore", "pipe", "pipe"],
env: { ...process.env, ...options.env },
encoding: "utf-8",
});
return {
status: result.status,
stdout: (result.stdout ?? "").trim(),
stderr: (result.stderr ?? "").trim(),
};
}