jmongard / Git.SemVersioning.Gradle

Gradle plugin for automatically versioning a project using semantic versioning and conventional commits with change log support based on git commit messages.
https://plugins.gradle.org/plugin/com.github.jmongard.git-semver-plugin
Apache License 2.0
38 stars 4 forks source link

Clarify which version number the auto-bump feature increments #20

Closed sschuberth closed 1 year ago

sschuberth commented 1 year ago

The docs say that with auto-bump "the version will be incremented by one", but it's unclear whether this refer to the major-, minor-, or patch-level version. Could you please clarify?

sschuberth commented 1 year ago

If I'm reading the code correctly, it's the patch-level of the version:

https://github.com/jmongard/Git.SemVersioning.Gradle/blob/8ffe01be99382e07e239c5a7a183c11972d97297/src/main/kotlin/git/semver/plugin/semver/SemVersion.kt#L199-L205

jmongard commented 1 year ago

Yes, It is the patch level, unless the last release were a pre-release e.g v11.12.13-next.14 the pre-release number is increased instead -> v11.12.13-next.15. If you are following conventional commits strictly only allowing fix/feat/breaking change to update the version number disable autoBump. Then you could do a release and afterwards i.e. a documentation update and the documentation commit will have the same version as the release. If autoBump is active the documentation commit will instead have patch version+1.

Care must also be taken if you run your build in a CI environment not to make any local changes on the build machine. This could cause the calculated version to be increased with -SNAPSHOT added to the version. Call to git status to figure out what is modified or use noDirtyCheck=true setting.