Our startup has about 5 scala projects for which we frequently need to push updates to production. Because of our rapid pace, I quickly found the sbt release plugin to be too much overhead and thus have been pushing SNAPSHOTS out throughout the day. We have a build server (Jenkins) in the cloud - that could be used to generate releases as well, but even this slows us down.
Are there any good plugins that can do something like grab the git checkout hash and user that (along with a date) as the version?
Thanks to sbt's Process API, you actually need very little to include the git hash in your version:
version in ThisBuild := "1.0-" + Process("git rev-parse HEAD").lines.head
Use git rev-parse --short HEAD
for the short version of a git hash.
Of course for better reuse, you could move the Process
part into its own setting and just do something like:
version in ThisBuild <<= gitSha("1.0-" + _)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With