Merge pull request #47 from alehechka/master

Customizable RC and Patch wording to new bump versions
This commit is contained in:
Phil 2020-10-09 19:25:53 +02:00 committed by GitHub
commit b67fbc3a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -47,6 +47,9 @@ Make sure you use the `actions/checkout@v2` action!
with: with:
minor-wording: 'add,Adds,new' minor-wording: 'add,Adds,new'
major-wording: 'MAJOR,cut-major' major-wording: 'MAJOR,cut-major'
patch-wording: 'patch,fixes' # Providing patch-wording will override commits
# defaulting to a patch bump.
rc-wording: 'RELEASE,alpha'
``` ```
**PACKAGEJSON_DIR:** Param to parse the location of the desired package.json (optional). Example: **PACKAGEJSON_DIR:** Param to parse the location of the desired package.json (optional). Example:

View File

@ -18,6 +18,11 @@ inputs:
major-wording: major-wording:
description: 'Words list that trigger a major version bump' description: 'Words list that trigger a major version bump'
default: 'BREAKING CHANGE,major' default: 'BREAKING CHANGE,major'
patch-wording:
description: 'Words list that trigger a patch version bump'
rc-wording:
description: 'Words list that trigger a patch version bump'
default: 'pre-alpha,pre-beta,pre-rc'
skip-tag: skip-tag:
description: 'Avoid to add a TAG to the version update commit' description: 'Avoid to add a TAG to the version update commit'
default: 'false' default: 'false'

View File

@ -28,7 +28,8 @@ 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 = ['pre-alpha', 'pre-beta', 'pre-rc'] const patchWords = process.env['INPUT_PATCH-WORDING'].split(',')
const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',')
let version = 'patch' let version = 'patch'
let foundWord = null; let foundWord = null;
@ -49,6 +50,15 @@ Toolkit.run(async tools => {
))) { ))) {
const preid = foundWord.split("-")[1]; const preid = foundWord.split("-")[1];
version = `prerelease --preid=${preid}`; version = `prerelease --preid=${preid}`;
} else if (patchWords && Array.isArray(patchWords)) {
if (!messages.some(message => patchWords.some(word => message.includes(word)))) {
version = null
}
}
if (version === null) {
tools.exit.success('No version keywords found, skipping bump.')
return
} }
try { try {