sbt-calver is an sbt plugin that automatically sets version of your project to calver format.
Inpired by:
Add this to your sbt build plugins:
addSbtPlugin("io.github.slivkamiro" % "sbt-calver" % "x.y.z")Supported configuration options:
versionFormat- changes how the date is formatted in version , defaults toYY.MMwhich produces version likeYY.MM.patch
Assuming default versionFormat your version will be set to:
| Current Date | Tag | Dist | HEAD SHA | dirty | version | description |
|---|---|---|---|---|---|---|
| 2023-07-11 | <none> | - | 0123abc | no | 23.07.1-0123abc | untagged repository |
| 2023-07-11 | <none> | - | 0123abc | yes | 23.07.1-0123abc-20230711-1030 | uncomitted changes on untagged repository |
| 2023-07-11 | 23.06.1 | 0 | - | no | 23.07.1 | at the tag at different date - no code changes needed to change version |
| 2023-07-11 | 23.06.1 | - | 0123abc | yes | 23.07.1-0123abc-20230811-1030 | uncomitted changes at different date |
| 2023-07-11 | 23.06.1 | 1 | 0123abc | no | 23.07.1-0123abc | ahead of master at different date |
| 2023-07-11 | 23.07.1 | 0 | - | no | 23.07.1 | at the tag |
| 2023-07-11 | 23.07.1 | - | 0123abc | yes | 23.07.2-0123abc-20230711-1030 | uncomitted changes |
| 2023-07-11 | 23.07.1 | 1 | 0123abc | no | 23.07.2-0123abc | ahead of master |
Where:
tagmeans what is the latest tag (relative to HEAD)distmeans the distance of the HEAD commit from the tagdirtyrefers to whether there are local changes in the git repo