Files
modelstudioai__cli/tools/release/lib/packages.mjs
T
若麒 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

37 lines
1.0 KiB
JavaScript

import { readFileSync, writeFileSync } from "fs";
import { dirname, join, resolve } from "path";
import { fileURLToPath } from "url";
export const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
export const PACKAGES = [
{ key: "core", dir: "packages/core", name: "bailian-cli-core" },
{ key: "cli", dir: "packages/cli", name: "bailian-cli" },
];
export function readJson(path) {
return JSON.parse(readFileSync(path, "utf-8"));
}
export function packageJsonPath(pkg) {
return join(ROOT, pkg.dir, "package.json");
}
export function readPackageJson(pkg) {
return readJson(packageJsonPath(pkg));
}
export function writePackageJson(pkg, json) {
writeFileSync(packageJsonPath(pkg), `${JSON.stringify(json, null, 2)}\n`);
}
export function tarballFileName(name, version) {
return `${name.replace(/^@/, "").replace("/", "-")}-${version}.tgz`;
}
export function findPackage(key) {
const pkg = PACKAGES.find((p) => p.key === key);
if (!pkg) throw new Error(`unknown package key: ${key}`);
return pkg;
}