From b456c60a76da51be0633086cbdd0d777ed0e17d0 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Mon, 7 Dec 2020 18:45:54 +0000 Subject: [PATCH] Add material theme to paradox (#98) * Add material theme to paradox * Add paradox site publish on release * Add sbt-site and sbt-ghpages --- .github/workflows/ci.yml | 8 +++++++ README.md | 2 +- build.sbt | 35 ++++++++++++++++++++++++---- docs/src/{main/paradox => }/index.md | 13 ++++++++--- project/plugins.sbt | 3 +++ 5 files changed, 52 insertions(+), 9 deletions(-) rename docs/src/{main/paradox => }/index.md (96%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60d70950..0f4a77df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,6 +147,14 @@ jobs: - run: sbt ++${{ matrix.scala }} release + - run: sbt ++${{ matrix.scala }} docs/makeSite + + - uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/target/site + build-docs: name: Build docs strategy: diff --git a/README.md b/README.md index 0c917524..8785db19 120000 --- a/README.md +++ b/README.md @@ -1 +1 @@ -docs/src/main/paradox/index.md \ No newline at end of file +docs/src/index.md \ No newline at end of file diff --git a/build.sbt b/build.sbt index 0eaaa7a7..ebcf3e3c 100644 --- a/build.sbt +++ b/build.sbt @@ -59,6 +59,20 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq( ) ) +ThisBuild / githubWorkflowPublish ++= Seq( + WorkflowStep.Sbt(List("docs/makeSite")), + WorkflowStep.Use( + "JamesIves", + "github-pages-deploy-action", + "3.7.1", + params = Map( + "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", + "BRANCH" -> "gh-pages", + "FOLDER" -> "docs/target/site" + ) + ) +) + ThisBuild / homepage := Some(url("https://github.com/typelevel/cats-parse")) ThisBuild / scmInfo := Some( @@ -79,19 +93,30 @@ lazy val root = project .settings(scalaVersion := "2.13.4") lazy val docs = project - .enablePlugins(ParadoxPlugin, MdocPlugin, NoPublishPlugin) + .enablePlugins( + ParadoxSitePlugin, + ParadoxMaterialThemePlugin, + MdocPlugin, + NoPublishPlugin, + GhpagesPlugin + ) .settings( name := "paradox-docs", libraryDependencies += jawnAst, - paradoxTheme := Some(builtinParadoxTheme("generic")), paradoxProperties in Compile ++= Map( "empty" -> "", "version" -> version.value ), githubWorkflowArtifactUpload := false, - mdocIn := (paradox / sourceDirectory).value, - paradox / sourceManaged := mdocOut.value, - Compile / paradox := (Compile / paradox).dependsOn(mdoc.toTask("")).value + git.remoteRepo := "git@github.com:typelevel/cats-parse.git", + mdocIn := (Compile / baseDirectory).value / "src", + Compile / paradox / sourceDirectory := mdocOut.value, + Compile / paradox := (Compile / paradox).dependsOn(mdoc.toTask("")).value, + Compile / paradoxMaterialTheme := ParadoxMaterialTheme() + .withColor("red", "orange") + .withFont("Ubuntu", "Ubuntu Mono") + .withCopyright("Copyright (c) 2020 Typelevel") + .withRepository(uri("https://github.com/typelevel/cats-parse")) ) .dependsOn(coreJVM, bench) diff --git a/docs/src/main/paradox/index.md b/docs/src/index.md similarity index 96% rename from docs/src/main/paradox/index.md rename to docs/src/index.md index 4c3aa4e6..806b1f87 100644 --- a/docs/src/main/paradox/index.md +++ b/docs/src/index.md @@ -4,9 +4,15 @@ A parsing library for the cats ecosystem. -To use in sbt add, the following to your `libraryDependencies`: -* `"org.typelevel" %% "cats-parse" % "0.1.0"` -* or `"org.typelevel" %%% "cats-parse" % "0.1.0"` in a Scala.js project. +To use in sbt add, the following to your `libraryDependencies`: + +```scala +// use this snippet for the JVM +libraryDependencies += "org.typelevel" %% "cats-parse" % "0.1.0" + +// use this snippet for JS, or cross-building +libraryDependencies += "org.typelevel" %%% "cats-parse" % "0.1.0" +``` The [API docs](https://oss.sonatype.org/service/local/repositories/releases/archive/org/typelevel/cats-parse_2.12/0.0.1/cats-parse_2.12-0.0.1-javadoc.jar/!/cats/parse/index.html) are published. @@ -25,6 +31,7 @@ this library has a few goals: Below is most of a json parser (the string unescaping is elided). This example can give you a feel for what it is like to use this library. + ```scala mdoc:invisible import cats.parse.bench.self.JsonStringUtil ``` diff --git a/project/plugins.sbt b/project/plugins.sbt index a2fd8cbe..73df7a13 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,3 +9,6 @@ addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.19.1") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.9.5") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13") +addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") +addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")