fix: correctly determine release to add to a channel
- Add only the most recent release to a channel (rather than adding all the one not added yet) - Avoid attempting to ad the version twice in case that version is already present in multiple upper branches
This commit is contained in:
@@ -20,9 +20,9 @@ test('Get the valid tags', async t => {
|
||||
{
|
||||
name: 'master',
|
||||
tags: [
|
||||
{gitTag: 'v1.0.0', version: '1.0.0', channel: undefined},
|
||||
{gitTag: 'v2.0.0', version: '2.0.0', channel: undefined},
|
||||
{gitTag: 'v3.0.0-beta.1', version: '3.0.0-beta.1', channel: undefined},
|
||||
{gitTag: 'v1.0.0', version: '1.0.0', channels: [undefined]},
|
||||
{gitTag: 'v2.0.0', version: '2.0.0', channels: [undefined]},
|
||||
{gitTag: 'v3.0.0-beta.1', version: '3.0.0-beta.1', channels: [undefined]},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@@ -55,23 +55,17 @@ test('Get the valid tags from multiple branches', async t => {
|
||||
{
|
||||
name: '1.x',
|
||||
tags: [
|
||||
{gitTag: 'v1.0.0', version: '1.0.0', channel: undefined},
|
||||
{gitTag: 'v1.0.0@1.x', version: '1.0.0', channel: '1.x'},
|
||||
{gitTag: 'v1.1.0', version: '1.1.0', channel: undefined},
|
||||
{gitTag: 'v1.1.0@1.x', version: '1.1.0', channel: '1.x'},
|
||||
{gitTag: 'v1.0.0', version: '1.0.0', channels: [undefined, '1.x']},
|
||||
{gitTag: 'v1.1.0', version: '1.1.0', channels: [undefined, '1.x']},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'master',
|
||||
tags: [
|
||||
...result[0].tags,
|
||||
{gitTag: 'v2.0.0', version: '2.0.0', channel: undefined},
|
||||
{gitTag: 'v2.0.0@next', version: '2.0.0', channel: 'next'},
|
||||
],
|
||||
tags: [...result[0].tags, {gitTag: 'v2.0.0', version: '2.0.0', channels: [undefined, 'next']}],
|
||||
},
|
||||
{
|
||||
name: 'next',
|
||||
tags: [...result[1].tags, {gitTag: 'v3.0.0@next', version: '3.0.0', channel: 'next'}],
|
||||
tags: [...result[1].tags, {gitTag: 'v3.0.0@next', version: '3.0.0', channels: ['next']}],
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -91,10 +85,8 @@ test('Match the tag name from the begining of the string and the channel from th
|
||||
{
|
||||
name: 'master',
|
||||
tags: [
|
||||
{gitTag: 'prefix@v1.0.0', version: '1.0.0', channel: undefined},
|
||||
{gitTag: 'prefix@v1.0.0@next', version: '1.0.0', channel: 'next'},
|
||||
{gitTag: 'prefix@v2.0.0', version: '2.0.0', channel: undefined},
|
||||
{gitTag: 'prefix@v2.0.0@next', version: '2.0.0', channel: 'next'},
|
||||
{gitTag: 'prefix@v1.0.0', version: '1.0.0', channels: [undefined, 'next']},
|
||||
{gitTag: 'prefix@v2.0.0', version: '2.0.0', channels: [undefined, 'next']},
|
||||
],
|
||||
},
|
||||
]);
|
||||
@@ -141,19 +133,19 @@ test('Get the highest valid tag corresponding to the "tagFormat"', async t => {
|
||||
|
||||
await gitTagVersion('1.0.0', undefined, {cwd});
|
||||
t.deepEqual(await getTags({cwd, options: {tagFormat: `\${version}`}}, [{name: 'master'}]), [
|
||||
{name: 'master', tags: [{gitTag: '1.0.0', version: '1.0.0', channel: undefined}]},
|
||||
{name: 'master', tags: [{gitTag: '1.0.0', version: '1.0.0', channels: [undefined]}]},
|
||||
]);
|
||||
|
||||
await gitTagVersion('foo-1.0.0-bar', undefined, {cwd});
|
||||
t.deepEqual(await getTags({cwd, options: {tagFormat: `foo-\${version}-bar`}}, [{name: 'master'}]), [
|
||||
{name: 'master', tags: [{gitTag: 'foo-1.0.0-bar', version: '1.0.0', channel: undefined}]},
|
||||
{name: 'master', tags: [{gitTag: 'foo-1.0.0-bar', version: '1.0.0', channels: [undefined]}]},
|
||||
]);
|
||||
|
||||
await gitTagVersion('foo-v1.0.0-bar', undefined, {cwd});
|
||||
t.deepEqual(await getTags({cwd, options: {tagFormat: `foo-v\${version}-bar`}}, [{name: 'master'}]), [
|
||||
{
|
||||
name: 'master',
|
||||
tags: [{gitTag: 'foo-v1.0.0-bar', version: '1.0.0', channel: undefined}],
|
||||
tags: [{gitTag: 'foo-v1.0.0-bar', version: '1.0.0', channels: [undefined]}],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -161,7 +153,7 @@ test('Get the highest valid tag corresponding to the "tagFormat"', async t => {
|
||||
t.deepEqual(await getTags({cwd, options: {tagFormat: `(.+)/\${version}/(a-z)`}}, [{name: 'master'}]), [
|
||||
{
|
||||
name: 'master',
|
||||
tags: [{gitTag: '(.+)/1.0.0/(a-z)', version: '1.0.0', channel: undefined}],
|
||||
tags: [{gitTag: '(.+)/1.0.0/(a-z)', version: '1.0.0', channels: [undefined]}],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -169,12 +161,12 @@ test('Get the highest valid tag corresponding to the "tagFormat"', async t => {
|
||||
t.deepEqual(await getTags({cwd, options: {tagFormat: `2.0.0-\${version}-bar.1`}}, [{name: 'master'}]), [
|
||||
{
|
||||
name: 'master',
|
||||
tags: [{gitTag: '2.0.0-1.0.0-bar.1', version: '1.0.0', channel: undefined}],
|
||||
tags: [{gitTag: '2.0.0-1.0.0-bar.1', version: '1.0.0', channels: [undefined]}],
|
||||
},
|
||||
]);
|
||||
|
||||
await gitTagVersion('3.0.0-bar.2', undefined, {cwd});
|
||||
t.deepEqual(await getTags({cwd, options: {tagFormat: `\${version}-bar.2`}}, [{name: 'master'}]), [
|
||||
{name: 'master', tags: [{gitTag: '3.0.0-bar.2', version: '3.0.0', channel: undefined}]},
|
||||
{name: 'master', tags: [{gitTag: '3.0.0-bar.2', version: '3.0.0', channels: [undefined]}]},
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user