Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#105 #136

Merged
merged 10 commits into from
Feb 10, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,18 @@ object TypelevelVersioningPlugin extends AutoPlugin {
None
}

// version here is the prefix used further to build a final version number
var version = latestInSeries.fold(tlBaseVersion.value)(_.toString)

// Looks for the distance to latest release in this series
latestInSeries.foreach { latestInSeries =>
Try(s"git describe --tags --match v$latestInSeries".!!.trim)
.collect { case Description(distance) => distance }
.foreach { distance => version += s"-$distance" }
}
if (version < baseV.toString)
osleonard marked this conversation as resolved.
Show resolved Hide resolved
sys.error(s"Your latest tag $version cannot be less than tlBaseVersion $baseV")
else
// Looks for the distance to latest release in this series
latestInSeries.foreach { latestInSeries =>
Try(s"git describe --tags --match v$latestInSeries".!!.trim)
.collect { case Description(distance) => distance }
.foreach { distance => version += s"-$distance" }
}

git.gitHeadCommit.value.foreach { sha => version += s"-${sha.take(7)}" }
version
Expand Down