Skip to content

Commit 8f89fa5

Browse files
authored
Merge pull request #358 from sbt/wip/dynver-awareness
2 parents 65dd58f + f288743 commit 8f89fa5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,19 @@ object CiReleasePlugin extends AutoPlugin {
143143
case None => backPubVersionToCommand(v)
144144
}
145145
},
146-
version ~= dropBackPubCommand
146+
version := {
147+
val v = version.value
148+
dynverGitDescribeOutput.value match {
149+
case Some(gitDescribe) =>
150+
val tagVersion = gitDescribe.ref.dropPrefix
151+
if (gitDescribe.isCleanAfterTag) {
152+
dropBackPubCommand(v)
153+
} else if (v.startsWith(tagVersion)) {
154+
dropBackPubCommand(tagVersion) + v.drop(tagVersion.size)
155+
} else v
156+
case _ => v
157+
}
158+
}
147159
)
148160

149161
override lazy val globalSettings: Seq[Def.Setting[_]] = List(

0 commit comments

Comments
 (0)