fix: correct log when adding channel to tag

This commit is contained in:
Pierre Vanduynslager 2019-12-10 00:13:45 -05:00
parent a8747c4f86
commit 61665be9ec
2 changed files with 19 additions and 8 deletions

View File

@ -112,7 +112,11 @@ async function run(context, plugins) {
await addNote({channels: [...currentRelease.channels, nextRelease.channel]}, nextRelease.gitHead, {cwd, env}); await addNote({channels: [...currentRelease.channels, nextRelease.channel]}, nextRelease.gitHead, {cwd, env});
await push(options.repositoryUrl, {cwd, env}); await push(options.repositoryUrl, {cwd, env});
await pushNotes(options.repositoryUrl, {cwd, env}); await pushNotes(options.repositoryUrl, {cwd, env});
logger.success(`Add channel ${nextRelease.channel} to tag ${nextRelease.gitTag}`); logger.success(
`Add ${nextRelease.channel ? `channel ${nextRelease.channel}` : 'default channel'} to tag ${
nextRelease.gitTag
}`
);
} }
context.branch.tags.push({ context.branch.tags.push({

View File

@ -785,7 +785,14 @@ async function addChannelMacro(t, mergeFunction) {
const publish = stub().resolves(); const publish = stub().resolves();
const success = stub().resolves(); const success = stub().resolves();
const config = {branches: [{name: 'master'}, {name: 'next'}], repositoryUrl, tagFormat: `v\${version}`}; const config = {
branches: [
{name: 'master', channel: 'latest'},
{name: 'next', channel: 'next'},
],
repositoryUrl,
tagFormat: `v\${version}`,
};
const options = { const options = {
...config, ...config,
verifyConditions, verifyConditions,
@ -796,11 +803,11 @@ async function addChannelMacro(t, mergeFunction) {
publish, publish,
success, success,
}; };
const nextRelease2 = { const nextRelease = {
name: 'v2.0.1', name: 'v2.0.1',
type: 'patch', type: 'patch',
version: '2.0.1', version: '2.0.1',
channel: null, channel: 'latest',
gitTag: 'v2.0.1', gitTag: 'v2.0.1',
gitHead: commits[2].hash, gitHead: commits[2].hash,
}; };
@ -812,13 +819,13 @@ async function addChannelMacro(t, mergeFunction) {
const result = await semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}); const result = await semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}});
t.deepEqual(result.releases, [ t.deepEqual(result.releases, [
{...nextRelease2, ...release1, notes, pluginName: '[Function: functionStub]'}, {...nextRelease, ...release1, notes, pluginName: '[Function: functionStub]'},
{...nextRelease2, notes, pluginName: '[Function: functionStub]'}, {...nextRelease, notes, pluginName: '[Function: functionStub]'},
]); ]);
// Verify the tag has been created on the local and remote repo and reference // Verify the tag has been created on the local and remote repo and reference
t.is(await gitTagHead(nextRelease2.gitTag, {cwd}), nextRelease2.gitHead); t.is(await gitTagHead(nextRelease.gitTag, {cwd}), nextRelease.gitHead);
t.is(await gitRemoteTagHead(repositoryUrl, nextRelease2.gitTag, {cwd}), nextRelease2.gitHead); t.is(await gitRemoteTagHead(repositoryUrl, nextRelease.gitTag, {cwd}), nextRelease.gitHead);
} }
addChannelMacro.title = providedTitle => `Add version to a channel after a merge (${providedTitle})`; addChannelMacro.title = providedTitle => `Add version to a channel after a merge (${providedTitle})`;