fix: release pipeline for npm

This commit is contained in:
Nathan Flurry 2026-02-11 09:23:35 -08:00
parent 6b1950f9ab
commit 8a1d17f165
5 changed files with 655 additions and 480 deletions

1069
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
"name": "release",
"version": "2.0.21",
"description": "",
"type": "module",
"main": "index.js",
"scripts": {
"check-types": "tsc --noEmit"
@ -12,7 +13,8 @@
"packageManager": "pnpm@10.13.1",
"devDependencies": {
"@types/node": "^24.3.0",
"@types/semver": "^7.5.8"
"@types/semver": "^7.5.8",
"typescript": "^5.7.0"
},
"dependencies": {
"commander": "^12.1.0",

View file

@ -240,12 +240,44 @@ export async function publishNpmCliShared(opts: ReleaseOpts) {
}
export async function publishNpmSdk(opts: ReleaseOpts) {
const isReleaseCandidate = opts.version.includes("-rc.");
const tag = isReleaseCandidate ? "rc" : (opts.latest ? "latest" : opts.minorVersionChannel);
// Publish acp-http-client (dependency of the SDK)
{
const acpHttpClientPath = join(opts.root, "sdks/acp-http-client");
const packageJsonPath = join(acpHttpClientPath, "package.json");
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
const name = packageJson.name;
const versionExists = await npmVersionExists(name, opts.version);
if (versionExists) {
console.log(
`Version ${opts.version} of ${name} already exists. Skipping...`,
);
} else {
console.log(`==> Building acp-http-client`);
await $({
stdio: "inherit",
cwd: opts.root,
})`pnpm --filter acp-http-client build`;
console.log(`==> Publishing to NPM: ${name}@${opts.version}`);
await $({
stdio: "inherit",
cwd: acpHttpClientPath,
})`pnpm publish --access public --tag ${tag} --no-git-checks`;
console.log(`✅ Published ${name}@${opts.version}`);
}
}
// Publish SDK
const sdkPath = join(opts.root, "sdks/typescript");
const packageJsonPath = join(sdkPath, "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(
@ -261,13 +293,7 @@ export async function publishNpmSdk(opts: ReleaseOpts) {
cwd: opts.root,
})`pnpm --filter sandbox-agent 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" : (opts.latest ? "latest" : opts.minorVersionChannel);
await $({
stdio: "inherit",
cwd: sdkPath,

View file

@ -1,10 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"],
"paths": {
"@/*": ["./src/*"]
}
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"types": ["node"]
},
"include": ["**/*.ts"],
"exclude": ["node_modules"]

View file

@ -22,6 +22,11 @@ export async function updateVersion(opts: ReleaseOpts) {
find: /"version": ".*"/,
replace: `"version": "${opts.version}"`,
},
{
path: "sdks/acp-http-client/package.json",
find: /"version": ".*"/,
replace: `"version": "${opts.version}"`,
},
{
path: "sdks/typescript/package.json",
find: /"version": ".*"/,
@ -56,8 +61,9 @@ export async function updateVersion(opts: ReleaseOpts) {
"sandbox-agent-error",
"sandbox-agent-agent-management",
"sandbox-agent-agent-credentials",
"sandbox-agent-universal-agent-schema",
"sandbox-agent-extracted-agent-schemas",
"sandbox-agent-opencode-adapter",
"sandbox-agent-opencode-server-manager",
"acp-http-adapter",
];
const cargoTomlPath = `${opts.root}/Cargo.toml`;