fix: handle errors when verifyConditions and verifyRelease are a pipeline
This commit is contained in:
parent
580ad9c3d2
commit
b0bc49063b
@ -75,7 +75,7 @@ module.exports = async () => {
|
||||
log.verbose('pre', 'Running pre-script.');
|
||||
log.verbose('pre', 'Veriying conditions.');
|
||||
try {
|
||||
await promisify(plugins.verifyConditions)(config);
|
||||
await plugins.verifyConditions(config);
|
||||
} catch (err) {
|
||||
log[options.debug ? 'warn' : 'error']('pre', err.message);
|
||||
if (!options.debug) process.exit(1);
|
||||
|
@ -10,20 +10,21 @@ module.exports = options => {
|
||||
};
|
||||
['verifyConditions', 'verifyRelease'].forEach(plugin => {
|
||||
if (!Array.isArray(options[plugin])) {
|
||||
plugins[plugin] = normalize(
|
||||
options[plugin],
|
||||
plugin === 'verifyConditions' ? '@semantic-release/condition-travis' : './plugin-noop'
|
||||
plugins[plugin] = promisify(
|
||||
normalize(
|
||||
options[plugin],
|
||||
plugin === 'verifyConditions' ? '@semantic-release/condition-travis' : './plugin-noop'
|
||||
)
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
plugins[plugin] = async pluginOptions => {
|
||||
return pSeries(
|
||||
options[plugin].map(step => {
|
||||
return () => promisify(normalize(step, './plugin-noop'))(pluginOptions);
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
plugins[plugin] = async pluginOptions => {
|
||||
return pSeries(
|
||||
options[plugin].map(step => {
|
||||
return () => promisify(normalize(step, './plugin-noop'))(pluginOptions);
|
||||
})
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
return plugins;
|
||||
|
@ -17,7 +17,7 @@ module.exports = async config => {
|
||||
version: type === 'initial' ? '1.0.0' : semver.inc(lastRelease.version, type),
|
||||
};
|
||||
|
||||
await promisify(verifyRelease)(assign({commits, lastRelease, nextRelease}, config));
|
||||
await verifyRelease(assign({commits, lastRelease, nextRelease}, config));
|
||||
|
||||
return nextRelease;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ test.serial('Increase version', async t => {
|
||||
plugins: {
|
||||
getLastRelease: callbackify(getLastRelease),
|
||||
analyzeCommits: callbackify(analyzeCommits),
|
||||
verifyRelease: callbackify(verifyRelease),
|
||||
verifyRelease: verifyRelease,
|
||||
},
|
||||
});
|
||||
|
||||
@ -89,7 +89,7 @@ test.serial('Initial version', async t => {
|
||||
plugins: {
|
||||
getLastRelease: callbackify(getLastRelease),
|
||||
analyzeCommits: callbackify(analyzeCommits),
|
||||
verifyRelease: callbackify(verifyRelease),
|
||||
verifyRelease: verifyRelease,
|
||||
},
|
||||
});
|
||||
|
||||
@ -137,7 +137,7 @@ test.serial('Throws error if verifyRelease fails', async t => {
|
||||
plugins: {
|
||||
getLastRelease: callbackify(getLastRelease),
|
||||
analyzeCommits: callbackify(analyzeCommits),
|
||||
verifyRelease: callbackify(verifyRelease),
|
||||
verifyRelease: verifyRelease,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user