mirror of
https://github.com/cycjimmy/semantic-release-action.git
synced 2026-04-07 16:09:24 +00:00
feat(dry_run): add a new input - "dry_run"
This commit is contained in:
parent
d21e9173cb
commit
65686aabe7
3 changed files with 32 additions and 2 deletions
28
src/index.js
28
src/index.js
|
|
@ -5,6 +5,29 @@ const semanticRelease = require('semantic-release');
|
|||
|
||||
const OutputKey_NewReleasePublished = 'new-release-published';
|
||||
|
||||
/**
|
||||
* handleDryRunOption
|
||||
* @returns {{}|{dryRun: boolean}}
|
||||
*/
|
||||
const handleDryRunOption = () => {
|
||||
const dryRun = core.getInput('dry_run', {required: false}) || '';
|
||||
|
||||
switch (dryRun) {
|
||||
case 'true':
|
||||
return {dryRun: true};
|
||||
|
||||
case 'false':
|
||||
return {dryRun: false};
|
||||
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Release main task
|
||||
* @returns {Promise<Promise<never>|undefined>}
|
||||
*/
|
||||
const release = async () => {
|
||||
const branch = core.getInput('branch', {required: false}) || 'master';
|
||||
const extraPlugins = core.getInput('extra_plugins', {required: false}) || '';
|
||||
|
|
@ -26,7 +49,10 @@ const release = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
const result = await semanticRelease({branch});
|
||||
const result = await semanticRelease({
|
||||
branch,
|
||||
...(handleDryRunOption()),
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
core.debug('No release published.');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue