Skip to content

Commit

Permalink
Ignore Snapshot Version (#36)
Browse files Browse the repository at this point in the history
* ignore snapshot versions in readme file.

* fmt and fix.

* use normalized version.

* another fix.

* fmt and fix.

* fix and fmt.
  • Loading branch information
khajavi authored Jan 1, 2023
1 parent dbb42a5 commit 2dc2469
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,16 @@ object WebsitePlugin extends sbt.AutoPlugin {
regex.replaceAllIn(markdown, '(' + prefix + _.group(1) + ')')
}

lazy val normalizedVersion: Def.Initialize[Task[String]] =
Def.task(releaseVersion(sLog.value.warn(_)).getOrElse(version.value))

lazy val ignoreIndexSnapshotVersion: Def.Initialize[Task[Unit]] = Def.task {
if (version.value.endsWith("-SNAPSHOT"))
if (normalizedVersion.value.endsWith("-SNAPSHOT"))
exit("sed -i.bak s/@VERSION@/<version>/g docs/index.md".!)
}

lazy val revertIndexChanges: Def.Initialize[Task[Unit]] = Def.task {
if (version.value.endsWith("-SNAPSHOT")) {
if (normalizedVersion.value.endsWith("-SNAPSHOT")) {
exit("rm docs/index.md".!)
exit("cp docs/index.md.bak docs/index.md".!)
}
Expand Down

0 comments on commit 2dc2469

Please sign in to comment.