added prerelease support

This commit is contained in:
gmaggiodev 2020-10-06 17:19:47 +02:00
parent 5bdb5419ee
commit c4c54e048a
2 changed files with 4 additions and 1 deletions

View File

@ -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 "prerelease" then the pre-release version will be increased (for example 1.6.0-alpha.1 -> 1.6.0-alpha.2)
* 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.

View File

@ -13,7 +13,7 @@ Toolkit.run(async tools => {
const event = tools.context.payload const event = tools.context.payload
if (!event.commits) { if (!event.commits) {
console.log('Couldn\'t find any commits in this event, incrementing patch version...') console.log('Couldn\'t find any commits in this event, incrementing patch/prerelease version...')
} }
const messages = event.commits ? event.commits.map(commit => commit.message + '\n' + commit.body) : [] const messages = event.commits ? event.commits.map(commit => commit.message + '\n' + commit.body) : []
@ -34,6 +34,8 @@ Toolkit.run(async tools => {
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 => message.includes('prerelease'))) {
version = 'prerelease'
} }
try { try {