Merge pull request #36 from Eomm/customizable-wording
feat: customizable major and minor wording to bump new versions
This commit is contained in:
commit
88e90b6506
13
README.md
13
README.md
|
@ -14,7 +14,7 @@ Make sure you use the `actions/checkout@v2` action!
|
|||
### Workflow
|
||||
|
||||
* Based on the commit messages, increment the version from the latest release.
|
||||
* If the string "BREAKING CHANGE" or "major" is found anywhere in any of the commit messages or descriptions the major
|
||||
* If the string "BREAKING CHANGE", "major" or the Attention pattern `refactor!: drop support for Node 6` is found anywhere in any of the commit messages or descriptions the major
|
||||
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"`.
|
||||
|
@ -30,6 +30,7 @@ Make sure you use the `actions/checkout@v2` action!
|
|||
with:
|
||||
tag-prefix: ''
|
||||
```
|
||||
|
||||
**skip-tag:** The tag is not added to the git repository (optional). Example:
|
||||
```yaml
|
||||
- name: 'Automated Version Bump'
|
||||
|
@ -37,6 +38,16 @@ Make sure you use the `actions/checkout@v2` action!
|
|||
with:
|
||||
skip-tag: 'true'
|
||||
```
|
||||
|
||||
**wording:** Customize the messages that trigger the version bump. It must be a string, case sensitive, coma separated (optional). Example:
|
||||
```yaml
|
||||
- name: 'Automated Version Bump'
|
||||
uses: 'phips28/gh-action-bump-version@master'
|
||||
with:
|
||||
minor-wording: 'add,Adds,new'
|
||||
major-wording: 'MAJOR,cut-major'
|
||||
```
|
||||
|
||||
**PACKAGEJSON_DIR:** Param to parse the location of the desired package.json (optional). Example:
|
||||
```yaml
|
||||
- name: 'Automated Version Bump'
|
||||
|
|
|
@ -11,6 +11,13 @@ inputs:
|
|||
description: 'Prefix that is used for the git tag'
|
||||
default: ''
|
||||
required: false
|
||||
minor-wording:
|
||||
description: 'Words list that trigger a minor version bump'
|
||||
default: 'feat,minor'
|
||||
required: false
|
||||
major-wording:
|
||||
description: 'Words list that trigger a major version bump'
|
||||
default: 'BREAKING CHANGE,major'
|
||||
skip-tag:
|
||||
description: 'Avoid to add a TAG to the version update commit'
|
||||
default: 'false'
|
||||
|
|
7
index.js
7
index.js
|
@ -25,11 +25,12 @@ Toolkit.run(async tools => {
|
|||
return
|
||||
}
|
||||
|
||||
const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',')
|
||||
const minorWords = process.env['INPUT_MINOR-WORDING'].split(',')
|
||||
let version = 'patch'
|
||||
if (messages.map(message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || message.includes('BREAKING CHANGE') || message.includes('major')).includes(true)) {
|
||||
if (messages.some(message => /^([a-zA-Z]+)(\(.+\))?(\!)\:/.test(message) || majorWords.some(word => message.includes(word)))) {
|
||||
version = 'major'
|
||||
} else if (messages.map(
|
||||
message => message.toLowerCase().startsWith('feat') || message.toLowerCase().includes('minor')).includes(true)) {
|
||||
} else if (messages.some(message => minorWords.some(word => message.includes(word)))) {
|
||||
version = 'minor'
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue