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
10
action.yml
10
action.yml
|
@ -61,6 +61,14 @@ inputs:
|
||||||
|
|
||||||
skip-on-empty:
|
skip-on-empty:
|
||||||
description: 'Do nothing when the changelog from the latest release is 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'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
@ -75,3 +83,5 @@ outputs:
|
||||||
description: 'The name of the generated tag'
|
description: 'The name of the generated tag'
|
||||||
skipped:
|
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'
|
||||||
|
|
26
src/index.js
26
src/index.js
|
@ -63,20 +63,34 @@ async function run() {
|
||||||
await changelog.generateFileChangelog(tagPrefix, preset, jsonPackage, outputFile, releaseCount)
|
await changelog.generateFileChangelog(tagPrefix, preset, jsonPackage, outputFile, releaseCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info('Push all changes')
|
const gitTag = `${tagPrefix}${versioning.newVersion}`
|
||||||
|
|
||||||
|
if (!skipCommit) {
|
||||||
// Add changed files to git
|
// Add changed files to git
|
||||||
await git.add('.')
|
await git.add('.')
|
||||||
await git.commit(commitMessage.replace('{version}', `${tagPrefix}${jsonPackage.version}`))
|
await git.commit(gitCommitMessage.replace('{version}', gitTag))
|
||||||
await git.createTag(`${tagPrefix}${jsonPackage.version}`)
|
}
|
||||||
|
|
||||||
|
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()
|
await git.push()
|
||||||
|
}
|
||||||
|
|
||||||
// Set outputs so other actions (for example actions/create-release) can use it
|
// Set outputs so other actions (for example actions/create-release) can use it
|
||||||
core.setOutput('changelog', stringChangelog)
|
core.setOutput('changelog', stringChangelog)
|
||||||
// Removes the version number from the changelog
|
|
||||||
core.setOutput('clean_changelog', cleanChangelog)
|
core.setOutput('clean_changelog', cleanChangelog)
|
||||||
core.setOutput('version', jsonPackage.version)
|
core.setOutput('version', versioning.newVersion)
|
||||||
core.setOutput('tag', `${tagPrefix}${jsonPackage.version}`)
|
|
||||||
|
// Only add the output tag if we did not skip it
|
||||||
|
if (!skipTag) {
|
||||||
|
core.setOutput('tag', gitTag)
|
||||||
|
}
|
||||||
|
|
||||||
core.setOutput('skipped', 'false')
|
core.setOutput('skipped', 'false')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue