Skip to content

Commit

Permalink
chore: Filter "HEAD" as branch name when building a release on a chec… (
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Sep 4, 2023
1 parent 0a135f8 commit 818fb41
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build.sbt
Expand Up @@ -21,8 +21,11 @@ Global / scalaVersion := Dependencies.ScalaVersion
Global / semanticdbEnabled := true
Global / semanticdbVersion := scalafixSemanticdb.revision

val gitCommit = ("git rev-parse HEAD" !!).trim
val gitBranch = Option("git rev-parse --abbrev-ref HEAD" !!).map(_.trim).filter(_ != "main").map(_.replace('/', '-'))
val gitCommit = ("git rev-parse HEAD" !!).trim
val gitBranch = Option("git rev-parse --abbrev-ref HEAD" !!)
.map(_.trim)
.filter(b => b != "main" || b != "HEAD")
.map(_.replace('/', '-'))
val gitVersion = ("git describe --tag --dirty --abbrev=7 --always " !!).trim + gitBranch.fold("")("-" + _)

ThisBuild / version := gitVersion
Expand Down

0 comments on commit 818fb41

Please sign in to comment.