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

StackOverflow https://stackoverflow.com/questions/17094118

سؤال

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-" + _)

نصائح أخرى

tl;dr Use sbt-git plugin.

Do enablePlugins(GitVersioning) in build.sbt of a module and start auto-generate your version using the plugin.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top