#76: added support for custom preid

This commit is contained in:
Md Fasihul Kabir 2021-03-09 17:34:54 +06:00
parent 4e36804825
commit 223bf2a2d9
3 changed files with 16 additions and 1 deletions

View File

@ -54,6 +54,17 @@ Make sure you use the `actions/checkout@v2` action!
default: prerelease default: prerelease
``` ```
**preid:** Set a preid value will building prerelease version (optional - defaults to 'rc'). Example:
```yaml
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
default: prerelease
preid: 'prc'
```
**wording:** Customize the messages that trigger the version bump. It must be a string, case sensitive, coma separated (optional). Example: **wording:** Customize the messages that trigger the version bump. It must be a string, case sensitive, coma separated (optional). Example:
```yaml ```yaml
- name: 'Automated Version Bump' - name: 'Automated Version Bump'

View File

@ -39,6 +39,10 @@ inputs:
description: 'Set a default version bump to use' description: 'Set a default version bump to use'
default: 'patch' default: 'patch'
required: false required: false
preid:
description: 'Set a custom preid for prerelease build'
default: 'rc'
required: false
commit-message: commit-message:
description: 'Set a custom commit message for version bump commit' description: 'Set a custom commit message for version bump commit'
default: '' default: ''

View File

@ -52,7 +52,7 @@ Toolkit.run(async tools => {
} }
} }
))) { ))) {
const preid = foundWord.split('-')[1] const preid = process.env.INPUT_PREID || foundWord.split('-')[1]
version = `prerelease --preid=${preid}` version = `prerelease --preid=${preid}`
} 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)))) {