Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What sbt plugins are available for frequent (multiple times per day) releases of a project from git?

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?

like image 774
Mad Dog Avatar asked Feb 17 '23 06:02

Mad Dog


1 Answers

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-" + _)
like image 190
gourlaysama Avatar answered Feb 27 '23 14:02

gourlaysama