ci: simplify ktx release flow

This commit is contained in:
Andrey Avtomonov 2026-05-19 16:33:41 +02:00
parent 7110aa6f5c
commit bbd9568287
14 changed files with 98 additions and 510 deletions

View file

@ -19,10 +19,21 @@ describe('semantic-release config', () => {
]);
const config = createReleaseConfig({ KTX_RELEASE_KIND: 'rc', GITHUB_REF_NAME: 'main' });
assert.deepEqual(
config.plugins.find((plugin) => Array.isArray(plugin) && plugin[0] === '@semantic-release/npm'),
[
'@semantic-release/npm',
{
pkgRoot: 'dist/public-npm-package',
tarballDir: 'dist/artifacts/npm',
},
],
);
assert.match(
releaseExecOptions(config).prepareCmd,
/update-public-release-version\.mjs "\$\{nextRelease\.version\}" "next"/,
);
assert.doesNotMatch(releaseExecOptions(config).publishCmd ?? '', /release:npm-publish/);
});
it('configures stable releases only from main with latest tag', () => {
@ -35,7 +46,7 @@ describe('semantic-release config', () => {
releaseExecOptions(config).prepareCmd,
/update-public-release-version\.mjs "\$\{nextRelease\.version\}" "latest"/,
);
assert.ok(config.plugins.includes('./scripts/semantic-release-version-policy.cjs'));
assert.equal(config.plugins.includes('./scripts/semantic-release-version-policy.cjs'), false);
});
it('rejects stable releases from non-main branches', () => {
@ -63,5 +74,12 @@ describe('semantic-release config', () => {
analyzer[1].releaseRules.some((rule) => rule.release === 'major'),
false,
);
assert.deepEqual(
analyzer[1].releaseRules.filter((rule) => rule.breaking || rule.type === 'major'),
[
{ breaking: true, release: 'minor' },
{ type: 'major', release: 'minor' },
],
);
});
});