mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
25299bc390
Remove pnpm run build (and pnpm run test) calls from publish-release.ts and prerelease.ts so that repository build code never executes with NPM_TOKEN in the environment. The CI build job (contents: read, no secrets) now handles all building and testing, uploading pre-built artifacts for the publish job to consume. For prerelease: extract version bumping into a new bump-prerelease.ts script that runs in the build job before the build step, ensuring the built artifacts contain the correct canary version numbers. Also fix prerelease build job to use persist-credentials: false, matching the publish-release build job pattern.
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
/**
|
|
* Bump package versions for a prerelease (runs in the secrets-free build job).
|
|
*
|
|
* This is extracted from prerelease.ts so that version bumping happens before
|
|
* the build, in a job that has no access to NPM_TOKEN or other publish secrets.
|
|
* The publish job then receives pre-built, correctly-versioned artifacts.
|
|
*
|
|
* Usage: tsx scripts/release/bump-prerelease.ts --scope <monorepo|angular> [--suffix <label>]
|
|
*/
|
|
|
|
import {
|
|
getCurrentVersion,
|
|
computePrereleaseVersion,
|
|
bumpPackages,
|
|
getPackagesForScope,
|
|
} from "./lib/versions.js";
|
|
import { loadConfig, type ReleaseScope } from "./lib/config.js";
|
|
|
|
const VALID_SCOPES = ["monorepo", "angular"];
|
|
|
|
function main() {
|
|
const argv = process.argv.slice(2);
|
|
const suffixIdx = argv.indexOf("--suffix");
|
|
const suffix = suffixIdx !== -1 ? argv[suffixIdx + 1] : undefined;
|
|
const scopeIdx = argv.indexOf("--scope");
|
|
const scope = (
|
|
scopeIdx !== -1 ? argv[scopeIdx + 1] : null
|
|
) as ReleaseScope | null;
|
|
|
|
if (!scope || !VALID_SCOPES.includes(scope)) {
|
|
console.error(
|
|
`Usage: bump-prerelease.ts --scope <${VALID_SCOPES.join("|")}> [--suffix <label>]`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
const config = loadConfig();
|
|
const distTag = config.prereleaseTag;
|
|
const currentVersion = getCurrentVersion(scope);
|
|
const prereleaseVersion = computePrereleaseVersion(currentVersion, suffix);
|
|
console.log(`Scope: ${scope}`);
|
|
console.log(`Current version: ${currentVersion}`);
|
|
console.log(`Prerelease version: ${prereleaseVersion}`);
|
|
console.log(`Dist tag: ${distTag}`);
|
|
|
|
// Bump versions in working directory (no commit)
|
|
const updated = bumpPackages(scope, prereleaseVersion);
|
|
console.log(`\nBumped ${updated.length} packages to ${prereleaseVersion}`);
|
|
for (const p of updated) {
|
|
console.log(` ${p.name}: ${p.oldVersion} -> ${p.newVersion}`);
|
|
}
|
|
}
|
|
|
|
main();
|