Merge pull request #78 from fkrafi/bug/support-preid-for-default-with-prerelease

supported preid for default prerelease version
This commit is contained in:
Phil 2021-03-10 10:59:29 +01:00 committed by GitHub
commit ab52598722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -37,7 +37,7 @@ Toolkit.run(async tools => {
let version = process.env.INPUT_DEFAULT || 'patch'
let foundWord = null
let preid = process.env.INPUT_PREID;
if (messages.some(
message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) {
version = 'major'
@ -52,14 +52,18 @@ Toolkit.run(async tools => {
}
}
))) {
const preid = process.env.INPUT_PREID || foundWord.split('-')[1]
version = `prerelease --preid=${preid}`
preid = foundWord.split('-')[1]
version = 'prerelease'
} else if (Array.isArray(patchWords) && patchWords.length) {
if (!messages.some(message => patchWords.some(word => message.includes(word)))) {
version = null
}
}
if (version === 'prerelease' && preid) {
version = `${version} --preid=${preid}`
}
if (version === null) {
tools.exit.success('No version keywords found, skipping bump.')
return