supported preid for default prerelease version

This commit is contained in:
Md Fasihul Kabir 2021-03-10 15:34:41 +06:00
parent 5e5a584898
commit ab791d324d
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 version = process.env.INPUT_DEFAULT || 'patch'
let foundWord = null let foundWord = null
let preid = process.env.INPUT_PREID;
if (messages.some( if (messages.some(
message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) { message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) {
version = 'major' version = 'major'
@ -52,14 +52,18 @@ Toolkit.run(async tools => {
} }
} }
))) { ))) {
const preid = process.env.INPUT_PREID || foundWord.split('-')[1] preid = foundWord.split('-')[1]
version = `prerelease --preid=${preid}` version = 'prerelease'
} else if (Array.isArray(patchWords) && patchWords.length) { } else if (Array.isArray(patchWords) && patchWords.length) {
if (!messages.some(message => patchWords.some(word => message.includes(word)))) { if (!messages.some(message => patchWords.some(word => message.includes(word)))) {
version = null version = null
} }
} }
if (version === 'prerelease' && preid) {
version = `${version} --preid=${preid}`
}
if (version === null) { if (version === null) {
tools.exit.success('No version keywords found, skipping bump.') tools.exit.success('No version keywords found, skipping bump.')
return return