mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2024-11-22 08:11:07 +07:00
Merge branch 'master' into min-version-21
This commit is contained in:
commit
bcecc8688a
@ -233,6 +233,10 @@ The default value (`0.0.1`) prevents a `0.0.0` from being created. This can also
|
||||
|
||||
For example, if the version `0.1.0` would already have been published, set the `minVersion` to the next patch to prevent a duplicate tag for that version.
|
||||
|
||||
|
||||
If this value is true, the tag will not be pushed.
|
||||
You can check for duplicate versions when creating a pull request.
|
||||
|
||||
```yaml
|
||||
- uses: butlerlogic/action-autotag@1.0.0
|
||||
with:
|
||||
|
@ -38,6 +38,9 @@ inputs:
|
||||
regex_pattern:
|
||||
description: An optional attribute containing the regular expression used to extract the version number.
|
||||
required: false
|
||||
dry_run:
|
||||
description: If this value is true, the tag will not be pushed.
|
||||
required: false
|
||||
outputs:
|
||||
tagname:
|
||||
description: Returns the new tag value. Empty if a tag is not created.
|
||||
|
15
app/main.js
15
app/main.js
@ -19,6 +19,8 @@ async function run () {
|
||||
const root = core.getInput('root', { required: false }) || core.getInput('package_root', { required: false }) || './'
|
||||
const strategy = (core.getInput('regex_pattern', { required: false }) || '').trim().length > 0 ? 'regex' : ((core.getInput('strategy', { required: false }) || 'package').trim().toLowerCase())
|
||||
|
||||
// If this value is true, the tag will not be pushed
|
||||
const isDryRun = core.getInput('dry_run', { required: false });
|
||||
|
||||
// Extract the version number using the supplied strategy
|
||||
let version = core.getInput('root', { required: false })
|
||||
@ -78,22 +80,29 @@ async function run () {
|
||||
core.getInput('tag_suffix', { required: false })
|
||||
)
|
||||
|
||||
core.warning(`Attempting to create ${tag.name} tag.`)
|
||||
if (isDryRun === "true") {
|
||||
core.warning(`"${tag.name}" tag is not pushed because the dry_run option was set.`)
|
||||
} else {
|
||||
core.warning(`Attempting to create ${tag.name} tag.`)
|
||||
}
|
||||
|
||||
core.setOutput('tagrequested', tag.name)
|
||||
core.setOutput('prerelease', tag.prerelease ? 'yes' : 'no')
|
||||
core.setOutput('build', tag.build ? 'yes' : 'no')
|
||||
|
||||
// Check for existance of tag and abort (short circuit) if it already exists.
|
||||
if (await tag.exists()) {
|
||||
core.warning(`"${tag.name}" tag already exists.` + os.EOL)
|
||||
core.setFailed(`"${tag.name}" tag already exists.` + os.EOL)
|
||||
core.setOutput('tagname', '')
|
||||
return
|
||||
}
|
||||
|
||||
// The tag setter will autocorrect the message if necessary.
|
||||
tag.message = core.getInput('tag_message', { required: false }).trim()
|
||||
await tag.push()
|
||||
|
||||
if (isDryRun !== "true") {
|
||||
await tag.push()
|
||||
}
|
||||
core.setOutput('tagname', tag.name)
|
||||
core.setOutput('tagsha', tag.sha)
|
||||
core.setOutput('taguri', tag.uri)
|
||||
|
Loading…
Reference in New Issue
Block a user