summaryrefslogtreecommitdiff
path: root/build.sc
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-10 18:01:22 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-10 18:01:22 -0800
commit5c55784ba1890616671705446322d45fc36a84bb (patch)
treede90762c3bb7c77e5779d5973a132a83259aa377 /build.sc
parent719ff8a6d79093d390b0d5ce7d01755e65fcd484 (diff)
downloadmill-5c55784ba1890616671705446322d45fc36a84bb.tar.gz
mill-5c55784ba1890616671705446322d45fc36a84bb.tar.bz2
mill-5c55784ba1890616671705446322d45fc36a84bb.zip
remove timestamp from auto-publishing to ensure the artifacts published from the same clean repo have the same version
Diffstat (limited to 'build.sc')
-rwxr-xr-xbuild.sc9
1 files changed, 7 insertions, 2 deletions
diff --git a/build.sc b/build.sc
index f9066dbd..80a0db03 100755
--- a/build.sc
+++ b/build.sc
@@ -234,8 +234,13 @@ def publishVersion = T.input{
tag match{
case Some(t) => (t, t)
case None =>
- val timestamp = java.time.Instant.now().toString.replaceAll(":|\\.", "-")
- ("unstable", timestamp + "-" + gitHead())
+ val latestTaggedVersion = %%('git, 'describe, "--abbrev=0", "--tags")(pwd).out.trim
+
+ val commitsSinceLastTag =
+ %%('git, "rev-list", 'master, "--count")(pwd).out.trim.toInt -
+ %%('git, "rev-list", latestTaggedVersion, "--count")(pwd).out.trim.toInt
+
+ ("unstable", s"$latestTaggedVersion-$commitsSinceLastTag-${gitHead().take(6)}")
}
}