Allow the version upgrade to be executed on a separate branch

This commit is contained in:
Daniel Kao 2020-11-25 12:15:10 +08:00
parent 60351cdb6f
commit 5d776519d3
No known key found for this signature in database
GPG Key ID: C0B460E9BB89027B
2 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,10 @@ inputs:
description: 'Custom dir to the package' description: 'Custom dir to the package'
default: '' default: ''
required: false required: false
branch:
description: 'A separate branch to perform the version bump on'
default: ''
required: false
default: default:
description: 'Set a default version bump to use' description: 'Set a default version bump to use'
default: 'patch' default: 'patch'

View File

@ -29,7 +29,7 @@ Toolkit.run(async tools => {
const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',') const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',')
const minorWords = process.env['INPUT_MINOR-WORDING'].split(',') const minorWords = process.env['INPUT_MINOR-WORDING'].split(',')
const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',') const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',')
// if patch words aren't specified, any commit message qualifies as a patch // if patch words aren't specified, any commit message qualifies as a patch
const patchWords = process.env['INPUT_PATCH-WORDING'] ? process.env['INPUT_PATCH-WORDING'].split(',') : null const patchWords = process.env['INPUT_PATCH-WORDING'] ? process.env['INPUT_PATCH-WORDING'].split(',') : null
@ -78,6 +78,9 @@ Toolkit.run(async tools => {
currentBranch = process.env.GITHUB_HEAD_REF currentBranch = process.env.GITHUB_HEAD_REF
isPullRequest = true isPullRequest = true
} }
if (process.env['INPUT_TAG-BRANCH']) {
currentBranch = process.env['INPUT_TAG-BRANCH']
}
console.log('currentBranch:', currentBranch) console.log('currentBranch:', currentBranch)
// do it in the current checked out github branch (DETACHED HEAD) // do it in the current checked out github branch (DETACHED HEAD)
// important for further usage of the package.json version // important for further usage of the package.json version