Skip to content

Commit

Permalink
docs: Link the right revision to the right doc version
Browse files Browse the repository at this point in the history
  • Loading branch information
Iltotore committed Sep 11, 2023
1 parent 6ed9ebd commit e44de4b
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,23 @@ object docs extends BaseModule {
T.traverse(modules)(_.compileClasspath)().flatten
}

def gitTags = T {
os
.proc("git", "tag", "-l", "v*.*.*")
.call(VcsVersion.vcsBasePath)
.out
.trim()
.split("\n")
.reverse
}

def docVersions = T.source {
val targetDir = T.dest / "_assets"

val versions =
os
.proc("git", "tag", "-l", "v*.*.*")
.call(VcsVersion.vcsBasePath)
.out
.trim()
.split("\n")
gitTags()
.filterNot(v => v.contains("-RC") || v.isBlank)
.map(_.substring(1))
.reverse


def versionLink(version: String): String = {
val splat = version.split("\\.")
Expand All @@ -121,11 +124,18 @@ object docs extends BaseModule {

def docResources = T.sources(millSourcePath, docVersions().path)

def docRevision = T {
val version = main.publishVersion()
if(gitTags().contains(version)) version
else "main"
}

def scalaDocOptions = Seq(
"-project", "Iron",
"-project-version", main.publishVersion(),
"-versions-dictionary-url", "https://iltotore.github.io/iron/versions.json",
"-source-links:github://Iltotore/iron/main",
"-source-links:github://Iltotore/iron",
"-revision", docRevision(),
s"-social-links:github::${main.pomSettings().url}"
)
}
Expand Down

0 comments on commit e44de4b

Please sign in to comment.