Skip to content

Commit 6a0c3c9

Browse files
authored
Merge pull request #64 from nebula-plugins/better-shorten-defaults
Add better defaults for shortenedBranchPattern. Fixes #46.
2 parents ce57259 + d33e0b1 commit 6a0c3c9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ All tasks default to bumping the minor version.
4848
nebulaRelease {
4949
Set<String> releaseBranchPatterns = [/master/, /HEAD/, /(release(-|\/))?\d+(\.\d+)?\.x/, /v?\d+\.\d+\.\d+/] as Set
5050
Set<String> excludeBranchPatterns = [] as Set
51-
String shortenedBranchPattern = /(?:feature(?:-|\/))?(.+)/
51+
String shortenedBranchPattern = /(?:(?:bugfix|feature|hotfix|release)(?:-|\/))?(.+)/
5252

5353
void addReleaseBranchPattern(String pattern)
5454
void addExcludeBranchPattern(String pattern)
@@ -58,7 +58,7 @@ All tasks default to bumping the minor version.
5858
| ----------------------- | ------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5959
| releaseBranchPatterns | `Set<String>` | `[/master/, /HEAD/, /(release(-|\/))?\d+(\.\d+)?\.x/, /v?\d+\.\d+\.\d+/]` | Branch patterns that are acceptable to release from. The default pattern will match things like `master`, `1.2.x`, `release-42.x`, `release/2.x`, `v1.2.3`. If the set is empty releases will be possible from any branch that doesn't match `excludeBranchPatterns`. |
6060
| excludeBranchPatterns | `Set<String>` | `[]` | Branch patterns that you cannot release from. If a branch matches both `releaseBranchPatterns` and `excludeBranchPatterns` it will be excluded. |
61-
| shortenedBranchPattern | `String` | `/(?:feature(?:-|\/))?(.+)/` | Branch `widget1` will append `widget1` to snapshot version numbers, and branch `feature/widget2` will append `widget2` to snapshot version numbers. You may configure this field, the regex is expected to have exactly one capture group. |
61+
| shortenedBranchPattern | `String` | `/(?:(?:bugfix|feature|hotfix|release)(?:-|\/))?(.+)/` | Branch `widget1` will append `widget1` to snapshot version numbers, and branch `(feature|bugfix|release|hotfix)/widget2` will append `widget2` to snapshot version numbers. You may configure this field, the regex is expected to have exactly one capture group. |
6262

6363

6464
| Method | Arguments | Description |

src/main/groovy/nebula/plugin/release/ReleaseExtension.groovy

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ class ReleaseExtension {
2020
Set<String> excludeBranchPatterns = [] as Set
2121

2222
/**
23-
* This should be a regex pattern with one(1) capture group
23+
* This should be a regex pattern with one(1) capture group. By default shortens the typical
24+
* {bugfix|feature|hotfix|release}/branch-name to branch-name. The prefix is optional and a
25+
* dash may be used instead of the forward slash.
2426
*/
25-
String shortenedBranchPattern = /(?:feature(?:-|\/))?(.+)/
27+
String shortenedBranchPattern = /(?:(?:bugfix|feature|hotfix|release)(?:-|\/))?(.+)/
2628

2729
void addReleaseBranchPattern(String pattern) {
2830
releaseBranchPatterns.add(pattern)

0 commit comments

Comments
 (0)