Skip to content

Commit

Permalink
Merge pull request #660 from typelevel/update/mdoc-2.5.0
Browse files Browse the repository at this point in the history
Update mdoc, sbt-mdoc to 2.5.0
  • Loading branch information
armanbilge authored Nov 9, 2023
2 parents 6a44e1f + 65beed5 commit 1f41bce
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@8]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand Down
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pull_request_rules:
- status-success=Build and Test (macos-latest, 2.12, temurin@8, sbt-typelevelJVM)
- status-success=Build and Test (windows-latest, 2.12, temurin@8, sbt-typelevelJVM)
- status-success=Validate Steward Config (ubuntu-latest, temurin@11)
- status-success=Generate Site (ubuntu-latest, temurin@8)
- status-success=Generate Site (ubuntu-latest, temurin@11)
- '#approved-reviews-by>=1'
actions:
merge: {}
Expand Down
1 change: 1 addition & 0 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Using this plugin the following 2 settings have new default values:
- `tlSiteApiModule` (setting): The module that publishes API docs (default: `None`).
- `tlSiteApiPackage` (setting): The top-level package for your API docs (e.g. org.typlevel.sbt).
- `tlSiteKeepFiles` (setting): Whether to keep existing files when deploying site (default: `true`).
- `tlSiteJavaVersion` (setting): The Java version to use for the site job, must be >= 11 (default: first compatible choice from `githubWorkflowJavaVersions`, otherwise Temurin 11).
- `tlSiteGenerate` (setting): A sequence of workflow steps which generates the site (default: `[Sbt(List("tlSite"))]`).
- `tlSitePublish` (setting): A sequence of workflow steps which publishes the site (default: `peaceiris/actions-gh-pages`).
- `tlSitePublishBranch` (setting): The branch to publish the site from on every push. Set this to `None` if you only want to update the site on tag releases. (default: `main`)
Expand Down
2 changes: 1 addition & 1 deletion site/build.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.4.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.0")
addSbtPlugin("org.typelevel" % "laika-sbt" % "1.0.0")
34 changes: 30 additions & 4 deletions site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import sbt.Keys._
import sbt._

import scala.annotation.nowarn
import scala.util.Try

object TypelevelSitePlugin extends AutoPlugin {

Expand Down Expand Up @@ -58,6 +59,8 @@ object TypelevelSitePlugin extends AutoPlugin {

lazy val tlSiteKeepFiles =
settingKey[Boolean]("Whether to keep existing files when deploying site (default: true)")
lazy val tlSiteJavaVersion = settingKey[JavaSpec](
"The Java version to use for the site job, must be >= 11 (default: first compatible choice from `githubWorkflowJavaVersions`, otherwise Temurin 11)")
lazy val tlSiteGenerate = settingKey[Seq[WorkflowStep]](
"A sequence of workflow steps which generates the site (default: [Sbt(List(\"tlSite\"))])")
lazy val tlSitePublish = settingKey[Seq[WorkflowStep]](
Expand Down Expand Up @@ -92,6 +95,20 @@ object TypelevelSitePlugin extends AutoPlugin {
tlSiteApiPackage := None,
tlSiteRelatedProjects := Nil,
tlSiteKeepFiles := true,
tlSiteJavaVersion := {
githubWorkflowJavaVersions
.value
.collectFirst {
case spec @ JavaSpec(_, version)
if version
.split('.')
.headOption
.flatMap(v => Try(v.toInt).toOption)
.exists(_ >= 11) =>
spec
}
.getOrElse(JavaSpec.temurin("11"))
},
homepage := {
gitHubUserRepo.value.map {
case ("typelevel", repo) => url(s"https://typelevel.org/$repo")
Expand Down Expand Up @@ -209,16 +226,25 @@ object TypelevelSitePlugin extends AutoPlugin {
List.empty
}
},
ThisBuild / githubWorkflowAddedJobs +=
ThisBuild / githubWorkflowAddedJobs += {

val extraJava =
if (!githubWorkflowJavaVersions.value.contains(tlSiteJavaVersion.value))
WorkflowStep.SetupJava(List(tlSiteJavaVersion.value))
else Nil

WorkflowJob(
"site",
"Generate Site",
scalas = List.empty,
sbtStepPreamble = List.empty,
javas = List(githubWorkflowJavaVersions.value.head),
steps =
githubWorkflowJobSetup.value.toList ++ tlSiteGenerate.value ++ tlSitePublish.value
javas = List(tlSiteJavaVersion.value),
steps = githubWorkflowJobSetup.value.toList ++
extraJava ++
tlSiteGenerate.value ++
tlSitePublish.value
)
}
)

private def previewTask = Def
Expand Down

0 comments on commit 1f41bce

Please sign in to comment.