Skip to content

Instantly share code, notes, and snippets.

@fedesilva
Last active August 29, 2015 14:23
Show Gist options
  • Save fedesilva/fddecadd81b553664a3d to your computer and use it in GitHub Desktop.
Save fedesilva/fddecadd81b553664a3d to your computer and use it in GitHub Desktop.
Putting the sha where it belongs.
name := "test-build"
organization := "org.cosomojo"
version := "1.0.0-SNAPSHOT"
val sha = settingKey[String]("current git commit SHA")
sha in ThisBuild := Process("git rev-parse HEAD").lines.head.take(8)
version := s"${version.value}" + (if (version.value.contains("-SNAPSHOT")) "" else s"-${sha.value}")
enablePlugins(BuildInfoPlugin)
buildInfoKeys ++= Seq[BuildInfoKey](
name,
version,
scalaVersion,
sbtVersion,
sha
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment