vivin / gradle-semantic-build-versioning

Gradle plugin to generate version-numbers and tags using semantic versioning
MIT License
86 stars 32 forks source link

Function to create a new pre-release or bump an existing one in one step #109

Open alex42ree opened 5 years ago

alex42ree commented 5 years ago

We need a function that creates the next pre-release version regardless of the status of the last release.

Current behaviour for a NEW pre-release is providing the property "-PnewPreRelease". It does the following: Current version 1.0.0 -> new pre-release is 1.0.1-RC.0 Current version 1.0.1-RC.0 -> new pre-release is 1.0.2-RC.0 It always creates a new pre-release even if the latest version is already a pre-release.

Current behavior for INCREASING an existing pre-release version with "-PbumpComponent=pre-release" property is: Current version 1.0.0 -> ERROR, there is no existing pre-release (see below) Current version 1.0.0-SNAPSHOT -> ERROR, there is no existing pre-release (see below) Current version 1.0.0-RC.0 -> new pre-release is 1.0.1-RC.1

The bump function throws an error if there is no existing pre-release: „Cannot bump pre-release because the latest version is not a pre-release version. To create a new pre-release version, use newPreRelease instead“.

To create a new pre-release when the latest version is not a pre-release version or update a current pre-release version I would have to gather the latest version, check if it is a pre-release and then perform action accordingly. But this is something that the plugin could do in one step. Let’s say I had a property called „-PnewPreReleaseOrBumpPreRelease“, I would get the following behaviour:

Current version 1.0.0 -> pre-release is 1.0.1-RC.0 Current version 1.0.0-RC.0 -> pre-release is 1.0.0-RC.1 Current version 1.0.0-SNAPSHOT -> pre-release is 1.0.1-RC.0 Current version 1.0.0-RC.1 -> pre-release is 1.0.0-RC.2

Any thoughts?

I could create a pull request for this functionality.

vivin commented 4 years ago

That's a good idea. Something like -PnewOrBumpPreRelease.

I can definitely look at a PR.

Sorry for the late response by the way. I'm working full-time and going to school so I haven't been able to give the project the attention it deserves.