diff --git a/action.yml b/action.yml index 883989f..7bd9c2c 100644 --- a/action.yml +++ b/action.yml @@ -61,6 +61,14 @@ inputs: skip-on-empty: description: 'Do nothing when the changelog from the latest release is empty' + + skip-commit: + description: 'Do create a release commit' + default: 'false' + required: false + + skip-tag: + description: 'Do not create an new tag' default: 'false' required: false @@ -74,4 +82,6 @@ outputs: tag: description: 'The name of the generated tag' skipped: - description: 'boolean to check if this step have been skipped' \ No newline at end of file + description: 'boolean to check if this step have been skipped' + skipped: + description: 'boolean to check if this step have been skipped' diff --git a/src/index.js b/src/index.js index 3d623e8..ddac99a 100644 --- a/src/index.js +++ b/src/index.js @@ -63,20 +63,34 @@ async function run() { await changelog.generateFileChangelog(tagPrefix, preset, jsonPackage, outputFile, releaseCount) } - core.info('Push all changes') + const gitTag = `${tagPrefix}${versioning.newVersion}` - // Add changed files to git - await git.add('.') - await git.commit(commitMessage.replace('{version}', `${tagPrefix}${jsonPackage.version}`)) - await git.createTag(`${tagPrefix}${jsonPackage.version}`) - await git.push() + if (!skipCommit) { + // Add changed files to git + await git.add('.') + await git.commit(gitCommitMessage.replace('{version}', gitTag)) + } + + if (!skipTag) { + // Only create the tag if skip tag is false + await git.createTag(gitTag) + } + + if (!skipCommit || !skipTag) { + core.info('Push all changes') + await git.push() + } // Set outputs so other actions (for example actions/create-release) can use it core.setOutput('changelog', stringChangelog) - // Removes the version number from the changelog core.setOutput('clean_changelog', cleanChangelog) - core.setOutput('version', jsonPackage.version) - core.setOutput('tag', `${tagPrefix}${jsonPackage.version}`) + core.setOutput('version', versioning.newVersion) + + // Only add the output tag if we did not skip it + if (!skipTag) { + core.setOutput('tag', gitTag) + } + core.setOutput('skipped', 'false') })