feat: Added skip commit and skip tag
When skip commit is enabled no new commit will be created, when skip tag is enabled no new tag will be createdreleases/v3
parent
9ee9c27448
commit
3eab2417f9
12
action.yml
12
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'
|
||||
description: 'boolean to check if this step have been skipped'
|
||||
skipped:
|
||||
description: 'boolean to check if this step have been skipped'
|
||||
|
|
32
src/index.js
32
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')
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue