mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 09:01:17 +00:00
fix: release pipeline for npm
This commit is contained in:
parent
6b1950f9ab
commit
8a1d17f165
5 changed files with 655 additions and 480 deletions
1069
pnpm-lock.yaml
generated
1069
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,7 @@
|
||||||
"name": "release",
|
"name": "release",
|
||||||
"version": "2.0.21",
|
"version": "2.0.21",
|
||||||
"description": "",
|
"description": "",
|
||||||
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"check-types": "tsc --noEmit"
|
"check-types": "tsc --noEmit"
|
||||||
|
|
@ -12,7 +13,8 @@
|
||||||
"packageManager": "pnpm@10.13.1",
|
"packageManager": "pnpm@10.13.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.3.0",
|
"@types/node": "^24.3.0",
|
||||||
"@types/semver": "^7.5.8"
|
"@types/semver": "^7.5.8",
|
||||||
|
"typescript": "^5.7.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^12.1.0",
|
"commander": "^12.1.0",
|
||||||
|
|
|
||||||
|
|
@ -240,12 +240,44 @@ export async function publishNpmCliShared(opts: ReleaseOpts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function publishNpmSdk(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 sdkPath = join(opts.root, "sdks/typescript");
|
||||||
const packageJsonPath = join(sdkPath, "package.json");
|
const packageJsonPath = join(sdkPath, "package.json");
|
||||||
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
||||||
const name = packageJson.name;
|
const name = packageJson.name;
|
||||||
|
|
||||||
// Check if version already exists
|
|
||||||
const versionExists = await npmVersionExists(name, opts.version);
|
const versionExists = await npmVersionExists(name, opts.version);
|
||||||
if (versionExists) {
|
if (versionExists) {
|
||||||
console.log(
|
console.log(
|
||||||
|
|
@ -261,13 +293,7 @@ export async function publishNpmSdk(opts: ReleaseOpts) {
|
||||||
cwd: opts.root,
|
cwd: opts.root,
|
||||||
})`pnpm --filter sandbox-agent build`;
|
})`pnpm --filter sandbox-agent build`;
|
||||||
|
|
||||||
// Publish
|
|
||||||
console.log(`==> Publishing to NPM: ${name}@${opts.version}`);
|
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 $({
|
await $({
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
cwd: sdkPath,
|
cwd: sdkPath,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"types": ["node"],
|
"target": "ES2022",
|
||||||
"paths": {
|
"module": "ESNext",
|
||||||
"@/*": ["./src/*"]
|
"moduleResolution": "Bundler",
|
||||||
}
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"],
|
"include": ["**/*.ts"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ export async function updateVersion(opts: ReleaseOpts) {
|
||||||
find: /"version": ".*"/,
|
find: /"version": ".*"/,
|
||||||
replace: `"version": "${opts.version}"`,
|
replace: `"version": "${opts.version}"`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "sdks/acp-http-client/package.json",
|
||||||
|
find: /"version": ".*"/,
|
||||||
|
replace: `"version": "${opts.version}"`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "sdks/typescript/package.json",
|
path: "sdks/typescript/package.json",
|
||||||
find: /"version": ".*"/,
|
find: /"version": ".*"/,
|
||||||
|
|
@ -56,8 +61,9 @@ export async function updateVersion(opts: ReleaseOpts) {
|
||||||
"sandbox-agent-error",
|
"sandbox-agent-error",
|
||||||
"sandbox-agent-agent-management",
|
"sandbox-agent-agent-management",
|
||||||
"sandbox-agent-agent-credentials",
|
"sandbox-agent-agent-credentials",
|
||||||
"sandbox-agent-universal-agent-schema",
|
"sandbox-agent-opencode-adapter",
|
||||||
"sandbox-agent-extracted-agent-schemas",
|
"sandbox-agent-opencode-server-manager",
|
||||||
|
"acp-http-adapter",
|
||||||
];
|
];
|
||||||
|
|
||||||
const cargoTomlPath = `${opts.root}/Cargo.toml`;
|
const cargoTomlPath = `${opts.root}/Cargo.toml`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue