From c4c54e048ac0173a1b802a694af16894a81a7c7c Mon Sep 17 00:00:00 2001 From: gmaggiodev Date: Tue, 6 Oct 2020 17:19:47 +0200 Subject: [PATCH] added prerelease support --- README.md | 1 + index.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a30c69..c91aa19 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Make sure you use the `actions/checkout@v2` action! 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 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. * Push the bumped npm version in package.json back into the repo. * Push a tag for the new version back into the repo. diff --git a/index.js b/index.js index e558a44..5afd556 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ Toolkit.run(async tools => { const event = tools.context.payload 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) : [] @@ -34,6 +34,8 @@ Toolkit.run(async tools => { version = 'major' } else if (messages.some(message => minorWords.some(word => message.includes(word)))) { version = 'minor' + } else if (messages.some(message => message.includes('prerelease'))) { + version = 'prerelease' } try {