mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
fix(ci): run rc releases from next branch
This commit is contained in:
parent
c7e6b5001d
commit
3dca33ec11
5 changed files with 71 additions and 13 deletions
|
|
@ -16,9 +16,13 @@ describe('release workflow', () => {
|
|||
assert.match(workflow, /^ contents: write$/m);
|
||||
assert.match(workflow, /fetch-depth: 0/);
|
||||
assert.match(workflow, /registry-url: "https:\/\/registry\.npmjs\.org"/);
|
||||
assert.match(workflow, /Prepare next prerelease branch/);
|
||||
assert.match(workflow, /git checkout -B "\$\{KTX_PRERELEASE_BRANCH\}"/);
|
||||
assert.match(workflow, /GITHUB_REF="refs\/heads\/\$\{KTX_PRERELEASE_BRANCH\}"/);
|
||||
assert.match(workflow, /pnpm run semantic-release:dry-run/);
|
||||
assert.match(workflow, /pnpm run semantic-release$/m);
|
||||
assert.match(workflow, /KTX_RELEASE_KIND: \$\{\{ inputs.release_kind \}\}/);
|
||||
assert.match(workflow, /KTX_PRERELEASE_BRANCH: next/);
|
||||
assert.match(workflow, /FORCE_RELEASE: \$\{\{ inputs.force_release \}\}/);
|
||||
assert.match(workflow, /NODE_AUTH_TOKEN: \$\{\{ secrets.NPM_TOKEN \}\}/);
|
||||
assert.doesNotMatch(workflow, /^ push:/m);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@ 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';
|
||||
}
|
||||
|
|
@ -91,7 +95,7 @@ function releaseBranches(env = process.env) {
|
|||
const kind = releaseKind(env);
|
||||
|
||||
if (kind === 'rc') {
|
||||
return [{ name: branch, prerelease: 'rc', channel: 'next' }];
|
||||
return ['main', { name: prereleaseBranch(env), prerelease: 'rc', channel: 'next' }];
|
||||
}
|
||||
|
||||
if (kind === 'stable') {
|
||||
|
|
@ -170,6 +174,7 @@ function createReleaseConfig(env = process.env) {
|
|||
|
||||
module.exports = {
|
||||
createReleaseConfig,
|
||||
prereleaseBranch,
|
||||
releaseBranches,
|
||||
releaseKind,
|
||||
releaseTag,
|
||||
|
|
|
|||
|
|
@ -10,14 +10,15 @@ function releaseExecOptions(config) {
|
|||
}
|
||||
|
||||
describe('semantic-release config', () => {
|
||||
it('configures manual rc releases on the selected branch with next channel', () => {
|
||||
it('configures rc releases on a dedicated next prerelease branch', () => {
|
||||
assert.equal(releaseKind({ KTX_RELEASE_KIND: 'rc' }), 'rc');
|
||||
assert.equal(releaseTag('rc'), 'next');
|
||||
assert.deepEqual(releaseBranches({ KTX_RELEASE_KIND: 'rc', GITHUB_REF_NAME: 'release-candidate' }), [
|
||||
{ name: 'release-candidate', prerelease: 'rc', channel: 'next' },
|
||||
assert.deepEqual(releaseBranches({ KTX_RELEASE_KIND: 'rc', GITHUB_REF_NAME: 'main' }), [
|
||||
'main',
|
||||
{ name: 'next', prerelease: 'rc', channel: 'next' },
|
||||
]);
|
||||
|
||||
const config = createReleaseConfig({ KTX_RELEASE_KIND: 'rc', GITHUB_REF_NAME: 'release-candidate' });
|
||||
const config = createReleaseConfig({ KTX_RELEASE_KIND: 'rc', GITHUB_REF_NAME: 'main' });
|
||||
assert.match(
|
||||
releaseExecOptions(config).prepareCmd,
|
||||
/update-public-release-version\.mjs "\$\{nextRelease\.version\}" "next"/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue