mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-28 08:49:38 +02:00
feat(release): commit version files back to branch for one-version-everywhere
Add @semantic-release/git to the release plugin chain so the bumped package.json, release-policy.json, and packages/cli/package.json land back on the release branch after publish. This keeps the published npm version and the in-repo version files in sync, so local builds from main report the released version (e.g. ktx --version and the daemon /health endpoint via KTX_DAEMON_VERSION). Also widens assertPublicNpmReleaseTag to accept branch-<sanitized> tags, unblocking branch RC publishes that pass through update-public-release- version.mjs.
This commit is contained in:
parent
2667952aa9
commit
c859a22fda
8 changed files with 191 additions and 13 deletions
|
|
@ -21,6 +21,11 @@ async function writeReleaseFixture(root) {
|
|||
version: '0.0.0-private',
|
||||
private: true,
|
||||
});
|
||||
await writeJson(join(root, 'packages', 'cli', 'package.json'), {
|
||||
name: '@ktx/cli',
|
||||
version: '0.0.0-private',
|
||||
private: true,
|
||||
});
|
||||
await writeJson(join(root, 'release-policy.json'), {
|
||||
schemaVersion: 1,
|
||||
publicNpmPackageVersion: '0.1.0-rc.1',
|
||||
|
|
@ -60,6 +65,7 @@ describe('updatePublicReleaseVersion', () => {
|
|||
await updatePublicReleaseVersion(root, '0.1.0-rc.2', 'next');
|
||||
|
||||
assert.equal((await readJson(join(root, 'package.json'))).version, '0.1.0-rc.2');
|
||||
assert.equal((await readJson(join(root, 'packages', 'cli', 'package.json'))).version, '0.1.0-rc.2');
|
||||
assert.deepEqual(await readJson(join(root, 'release-policy.json')), {
|
||||
schemaVersion: 1,
|
||||
publicNpmPackageVersion: '0.1.0-rc.2',
|
||||
|
|
@ -93,6 +99,26 @@ describe('updatePublicReleaseVersion', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('accepts branch-prefixed npm release tags produced by branch RC publishes', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'ktx-release-version-branch-test-'));
|
||||
try {
|
||||
await writeReleaseFixture(root);
|
||||
|
||||
await updatePublicReleaseVersion(root, '0.1.0-feature-foo.0', 'branch-feature-foo');
|
||||
|
||||
assert.equal((await readJson(join(root, 'package.json'))).version, '0.1.0-feature-foo.0');
|
||||
assert.equal(
|
||||
(await readJson(join(root, 'packages', 'cli', 'package.json'))).version,
|
||||
'0.1.0-feature-foo.0',
|
||||
);
|
||||
const policy = await readJson(join(root, 'release-policy.json'));
|
||||
assert.equal(policy.publicNpmPackageVersion, '0.1.0-feature-foo.0');
|
||||
assert.equal(policy.npm.tag, 'branch-feature-foo');
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('rejects invalid versions and tags', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'ktx-release-version-invalid-test-'));
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue