Merge pull request #44 from gmaggiodev/master
Support for prerelease and --preId
This commit is contained in:
commit
79cd3bd5ee
|
@ -18,6 +18,7 @@ Make sure you use the `actions/checkout@v2` action!
|
||||||
version will be incremented.
|
version will be incremented.
|
||||||
* If a commit message begins with the string "feat" or includes "minor" then the minor version will be increased. This works
|
* If a commit message begins with the string "feat" or includes "minor" then the minor version will be increased. This works
|
||||||
for most common commit metadata for feature additions: `"feat: new API"` and `"feature: new API"`.
|
for most common commit metadata for feature additions: `"feat: new API"` and `"feature: new API"`.
|
||||||
|
* If a commit message contains the word "pre-alpha" or "pre-beta" or "pre-rc" then the pre-release version will be increased (for example specifying pre-alpha: 1.6.0-alpha.1 -> 1.6.0-alpha.2 or, specifying pre-beta: 1.6.0-alpha.1 -> 1.6.0-beta.0)
|
||||||
* All other changes will increment the patch version.
|
* All other changes will increment the patch version.
|
||||||
* Push the bumped npm version in package.json back into the repo.
|
* Push the bumped npm version in package.json back into the repo.
|
||||||
* Push a tag for the new version back into the repo.
|
* Push a tag for the new version back into the repo.
|
||||||
|
|
15
index.js
15
index.js
|
@ -28,12 +28,27 @@ 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']
|
||||||
|
|
||||||
let version = 'patch'
|
let version = 'patch'
|
||||||
|
let foundWord = null;
|
||||||
|
|
||||||
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'
|
||||||
} else if (messages.some(message => minorWords.some(word => message.includes(word)))) {
|
} else if (messages.some(message => minorWords.some(word => message.includes(word)))) {
|
||||||
version = 'minor'
|
version = 'minor'
|
||||||
|
} else if (messages.some(message => preReleaseWords.some(word => {
|
||||||
|
if (message.includes(word)) {
|
||||||
|
foundWord = word;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
))) {
|
||||||
|
const preid = foundWord.split("-")[1];
|
||||||
|
version = `prerelease --preid=${preid}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue