diff --git a/build.sbt b/build.sbt index 437677c02f..6248b5995c 100644 --- a/build.sbt +++ b/build.sbt @@ -1221,4 +1221,22 @@ lazy val docs = project .in(file("site-docs")) .dependsOn(core.jvm) .enablePlugins(MdocPlugin) - .settings(tlFatalWarnings := { if (tlIsScala3.value) false else tlFatalWarnings.value }) + .settings( + tlFatalWarnings := { if (tlIsScala3.value) false else tlFatalWarnings.value }, + mdocVariables := { + import scala.sys.process._ + val latestVersion = try { + val tags = "git tag --sort=-version:refname".!!.trim.split("\n") + val versionTags = tags.filter(_.matches("v\\d+\\.\\d+\\.\\d+.*")) + if (versionTags.nonEmpty) versionTags.head.drop(1) else version.value + } catch { case _: Exception => version.value } + + val latestVersion2x = try { + val tags = "git tag --sort=-version:refname".!!.trim.split("\n") + val version2xTags = tags.filter(_.matches("v2\\.\\d+\\.\\d+.*")) + if (version2xTags.nonEmpty) version2xTags.head.drop(1) else "2.5.5" + } catch { case _: Exception => "2.5.5" } + + Map("VERSION_3X" -> latestVersion, "VERSION_2X" -> latestVersion2x) + } + ) diff --git a/docs/getting-started.md b/docs/getting-started.md index 7fb1202d2b..6cf5fb2c68 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -6,7 +6,7 @@ title: Getting Started Add the following to your **build.sbt**: ```scala -libraryDependencies += "org.typelevel" %% "cats-effect" % "3.6.3" +libraryDependencies += "org.typelevel" %% "cats-effect" % "@VERSION_3X@" ``` Naturally, if you're using ScalaJS, you should replace the double `%%` with a triple `%%%`. If you're on Scala 2, it is *highly* recommended that you enable the [better-monadic-for](https://github.com/oleg-py/better-monadic-for) plugin, which fixes a number of surprising elements of the `for`-comprehension syntax in the Scala language: