mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2024-09-20 02:50:04 +07:00
provide proper default for version
This commit is contained in:
parent
af23f17f9f
commit
7f21e483b8
@ -17,7 +17,7 @@ async function run () {
|
|||||||
|
|
||||||
// Identify the tag parsing strategy
|
// Identify the tag parsing strategy
|
||||||
const strategy = (core.getInput('regex_pattern', { required: false }) || '').trim().length > 0 ? 'regex' : ((core.getInput('strategy', { required: false }) || 'package').trim().toLowerCase())
|
const strategy = (core.getInput('regex_pattern', { required: false }) || '').trim().length > 0 ? 'regex' : ((core.getInput('strategy', { required: false }) || 'package').trim().toLowerCase())
|
||||||
const root = core.getInput('root', { required: false }) || core.getInput('package_root', { required: false }) || (strategy === 'composer' ? 'composer.json' : './')
|
const root = core.getInput('root', { required: false }) || core.getInput('package_root', { required: false }) || (strategy === 'composer' ? 'composer.json' : null)
|
||||||
|
|
||||||
// If this value is true, the tag will not be pushed
|
// If this value is true, the tag will not be pushed
|
||||||
const isDryRun = core.getInput('dry_run', { required: false });
|
const isDryRun = core.getInput('dry_run', { required: false });
|
||||||
@ -29,13 +29,13 @@ async function run () {
|
|||||||
|
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case 'docker':
|
case 'docker':
|
||||||
version = version || (new Dockerfile(root)).version
|
version = version || (new Dockerfile(root || './')).version
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'composer':
|
case 'composer':
|
||||||
case 'package':
|
case 'package':
|
||||||
// Extract using the package strategy (this is the default strategy)
|
// Extract using the package strategy (this is the default strategy)
|
||||||
version = version || (new Package(root)).version
|
version = version || (new Package(root || './package.json')).version
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'regex':
|
case 'regex':
|
||||||
@ -104,8 +104,6 @@ async function run () {
|
|||||||
if (isDryRun !== "true") {
|
if (isDryRun !== "true") {
|
||||||
await tag.push()
|
await tag.push()
|
||||||
core.setOutput('tagcreated', 'yes')
|
core.setOutput('tagcreated', 'yes')
|
||||||
} else {
|
|
||||||
core.setOutput('tagcreated', 'no')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput('tagname', tag.name)
|
core.setOutput('tagname', tag.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user