vivin / gradle-semantic-build-versioning

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

Unable to specify suffix to be included in version #105

Closed matthewh86 closed 5 years ago

matthewh86 commented 5 years ago

Issue

Hello! I'm attempting to implement the following versioning scheme:

I don't think I can use the preRelease configuration, as there could be a version conflict if for some reason we tried to promote two release candidates with the same root version to production.

Resolution attempt

I have tried the following tag pattern, but ./gradlew printVersion yields the starting version again despite there being existing version tags (e.g. 0.0.1 and 0.0.1-RC).

tagPattern = ~/\d++\.\d++\.\d++-RC/

I also had to add a dummy preRelease section so that it ignores the -RC tags which look like a preRelease.

preRelease {
  startingVersion = 'PR.0'
  pattern = /PR/
  bump = {
    "PR.${((it - ~/^PR\./) as int) + 1}"
  }
}
vivin commented 5 years ago

I think the problem here is that -RC doesn't really fit with the semver standard. Anything after the semver is a pre-release identifier, and so would need to be treated as such. The -SNAPSHOT (or whatever you'd defined it as) suffix is only for local builds and isn't expected to be deployed.

matthewh86 commented 5 years ago

We've worked around this by specifying that release versions have -RELEASE after the version, rather than doing it the other way round of having -RC for unreleased, and the vanilla version for released.

Closing issue.