From 2dc2469871370dc90744073cb3f0e36cb9ca3ab3 Mon Sep 17 00:00:00 2001 From: Milad Khajavi Date: Sun, 1 Jan 2023 12:51:53 +0330 Subject: [PATCH] Ignore Snapshot Version (#36) * ignore snapshot versions in readme file. * fmt and fix. * use normalized version. * another fix. * fmt and fix. * fix and fmt. --- zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala b/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala index e1264e42..61a2f4d1 100644 --- a/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala +++ b/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala @@ -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@//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".!) }