fix: add cli-shared publishing to release workflow

This commit is contained in:
Nathan Flurry 2026-02-02 18:58:09 -08:00
parent 7404e86975
commit e0573ebaf5
3 changed files with 51 additions and 2 deletions

View file

@ -133,6 +133,43 @@ export async function publishCrates(opts: ReleaseOpts) {
console.log("✅ All crates published");
}
export async function publishNpmCliShared(opts: ReleaseOpts) {
const cliSharedPath = join(opts.root, "sdks/cli-shared");
const packageJsonPath = join(cliSharedPath, "package.json");
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
const name = packageJson.name;
// Check if version already exists
const versionExists = await npmVersionExists(name, opts.version);
if (versionExists) {
console.log(
`Version ${opts.version} of ${name} already exists. Skipping...`,
);
return;
}
// Build cli-shared
console.log(`==> Building @sandbox-agent/cli-shared`);
await $({
stdio: "inherit",
cwd: opts.root,
})`pnpm --filter @sandbox-agent/cli-shared build`;
// Publish
console.log(`==> Publishing to NPM: ${name}@${opts.version}`);
// Add --tag flag for release candidates
const isReleaseCandidate = opts.version.includes("-rc.");
const tag = isReleaseCandidate ? "rc" : "latest";
await $({
stdio: "inherit",
cwd: cliSharedPath,
})`pnpm publish --access public --tag ${tag} --no-git-checks`;
console.log(`✅ Published ${name}@${opts.version}`);
}
export async function publishNpmSdk(opts: ReleaseOpts) {
const sdkPath = join(opts.root, "sdks/typescript");
const packageJsonPath = join(sdkPath, "package.json");
@ -148,7 +185,7 @@ export async function publishNpmSdk(opts: ReleaseOpts) {
return;
}
// Build the SDK
// Build the SDK (cli-shared should already be built by publishNpmCliShared)
console.log(`==> Building TypeScript SDK`);
await $({
stdio: "inherit",