refactor(release): drop release-policy.json runtime dep and next branch

Strips the release-policy.json fallback from release-version.ts so the CLI
reads its version straight from packages/cli/package.json. dev → 0.0.0-private,
installed @kaelio/ktx → the real semver baked into the published package.json.
KtxCliPackageInfo collapses to { name, version, contextPackageName }; /health
no longer depends on version files surviving past a CI run.

Replaces the dual-branch (main + next) semantic-release model with a single-
branch model on main. rcs and stables interleave on the same branch via
{ name: 'main', prerelease: 'rc', channel: 'next' } / ['main']. Drops
@semantic-release/git and @semantic-release/changelog (nothing is committed
back to the repo on any channel) and the workflow's "Prepare next prerelease
branch" step plus the KTX_PRERELEASE_BRANCH plumbing. The git tag plus the
published npm artifact carry the version forward.

Updates docs/release.md, removes the two now-unused devDeps, regenerates
pnpm-lock.yaml. 611/611 @ktx/cli tests, 173/173 script tests, type-check,
biome, knip all clean.
This commit is contained in:
Andrey Avtomonov 2026-05-20 13:45:50 +02:00
parent a0d3ddbbc2
commit 66b674f73a
13 changed files with 83 additions and 320 deletions

View file

@ -82,46 +82,23 @@ function releaseKind(env) {
return env.KTX_RELEASE_KIND || env.INPUT_RELEASE_KIND || 'rc';
}
function prereleaseBranch(env) {
return env.KTX_PRERELEASE_BRANCH || env.INPUT_PRERELEASE_BRANCH || 'next';
}
function releaseTag(kind) {
return kind === 'rc' ? 'next' : 'latest';
}
function releaseChangelogPlugins(kind) {
return kind === 'rc' ? ['@semantic-release/changelog'] : [];
}
function releaseGitPlugins(kind) {
if (kind !== 'rc') {
return [];
}
return [
[
'@semantic-release/git',
{
assets: ['CHANGELOG.md', 'package.json', 'release-policy.json'],
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
];
}
function releaseBranches(env = process.env) {
const branch = currentBranch(env);
const kind = releaseKind(env);
if (branch !== 'main') {
throw new Error(`KTX releases must run from main, got ${branch}`);
}
if (kind === 'rc') {
return ['main', { name: prereleaseBranch(env), prerelease: 'rc', channel: 'next' }];
return [{ name: 'main', prerelease: 'rc', channel: 'next' }];
}
if (kind === 'stable') {
if (branch !== 'main') {
throw new Error(`Stable KTX releases must run from main, got ${branch}`);
}
return ['main'];
}
@ -157,7 +134,6 @@ function createReleaseConfig(env = process.env) {
},
},
],
...releaseChangelogPlugins(kind),
[
'@semantic-release/exec',
{
@ -172,7 +148,6 @@ function createReleaseConfig(env = process.env) {
].join(' && '),
},
],
...releaseGitPlugins(kind),
[
'@semantic-release/github',
{
@ -188,7 +163,6 @@ function createReleaseConfig(env = process.env) {
module.exports = {
createReleaseConfig,
prereleaseBranch,
releaseBranches,
releaseKind,
releaseTag,