Skip to content

Commit

Permalink
Close #165 - Replace sbt-microsites with Docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Jul 25, 2020
1 parent d29fd61 commit bb42a04
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 90 deletions.
85 changes: 51 additions & 34 deletions .github/workflows/publish-github-pages.yml
Expand Up @@ -10,38 +10,55 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
scala:
- { version: "2.13.3", binary-version: "2.13", java-version: "11" }

steps:
- uses: actions/checkout@v1

- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-scala-2_13-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-coursier-scala-2_13-
- name: Cache Ivy
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-ivy-scala-2_13-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-ivy-scala-2_13-
- name: publish GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_AUTH_TOKEN }}
run: |
docker run \
-e GITHUB_TOKEN=$GITHUB_TOKEN \
-v ${{ github.workspace }}:/app \
-v ~/.cache/coursier:/root/.cache/coursier:z \
-v ~/.ivy2/cache:/root/.ivy2/cache:z \
k3vin/sbt-java8-jekyll:latest /bin/bash -c "cd /app && sbt 'project docs' clean publishMicrosite"
- name: correct dir permission
run: |
sudo chown -R $(whoami):docker ~/.ivy2
sudo chown -R $(whoami):docker ~/.cache
sudo chown -R $(whoami):docker ${{ github.workspace }}
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.scala.java-version }}
- uses: actions/setup-node@v1
with:
node-version: '14.4.0'
registry-url: 'https://registry.npmjs.org'

- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-scala-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-coursier-scala-${{ matrix.scala.binary-version }}-
- name: Cache Ivy
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-ivy-scala-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-ivy-scala-${{ matrix.scala.binary-version }}-
- name: Cache npm
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build and publish website
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sbt clean \
docs/mdoc \
docs/docusaurGenerateAlgoliaConfigFile \
docs/docusaurInstall \
docs/docusaurCleanBuild \
docs/docusaurBuild \
docs/publishToGitHubPages
5 changes: 1 addition & 4 deletions README.md
Expand Up @@ -8,7 +8,4 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.kevinlee/just-fp_2.13/badge.svg)](https://search.maven.org/artifact/io.kevinlee/just-fp_2.13)
[![Latest version](https://index.scala-lang.org/kevin-lee/just-fp/just-fp/latest.svg)](https://index.scala-lang.org/kevin-lee/just-fp/just-fp)


A small Functional Programming library. This is not meant to be an alternative to Scalaz or Cats. The reason for having this library is that in your project you don't want to have Scalaz or Cats as its dependency and you only need much smaller set of functional programming features than what Scalaz or Cats offers. So the users of your library can choose Scalaz or Cats to be used with your library.

Please visit the [homepage](https://kevin-lee.github.io/just-fp) for more details.
# Please visit [https://kevin-lee.github.io/just-fp](https://kevin-lee.github.io/just-fp)
122 changes: 70 additions & 52 deletions build.sbt
Expand Up @@ -7,7 +7,11 @@ import microsites.ConfigYml
val ProjectScalaVersion: String = "2.13.1"
val CrossScalaVersions: Seq[String] = Seq("2.10.7", "2.11.12", "2.12.11", ProjectScalaVersion)

def prefixedProjectName(name: String) = s"just-fp${if (name.isEmpty) "" else s"-$name"}"
val GitHubUsername = "Kevin-Lee"
val RepoName = "just-fp"
val ProjectName = RepoName

def prefixedProjectName(name: String) = s"$ProjectName${if (name.isEmpty) "" else s"-$name"}"

lazy val noPublish = Seq(
publish := {},
Expand All @@ -31,24 +35,15 @@ ThisBuild / scalaVersion := ProjectScalaVersion
ThisBuild / version := ProjectVersion
ThisBuild / organization := "io.kevinlee"
ThisBuild / developers := List(
Developer("Kevin-Lee", "Kevin Lee", "kevin.code@kevinlee.io", url("https://github.com/Kevin-Lee"))
Developer(GitHubUsername, "Kevin Lee", "kevin.code@kevinlee.io", url(s"https://github.com/$GitHubUsername"))
)
ThisBuild / homepage := Some(url("https://github.com/Kevin-Lee/just-fp"))
ThisBuild / homepage := Some(url(s"https://github.com/$GitHubUsername/$RepoName"))
ThisBuild / scmInfo :=
Some(ScmInfo(
url("https://github.com/Kevin-Lee/just-fp")
, "git@github.com:Kevin-Lee/just-fp.git"
url(s"https://github.com/$GitHubUsername/$RepoName")
, s"git@github.com:$GitHubUsername/$RepoName.git"
))

lazy val justFp = (project in file("."))
.enablePlugins(DevOopsGitReleasePlugin)
.settings(
name := prefixedProjectName("")
, description := "Just FP Lib"
)
.settings(noPublish)
.aggregate(core, docs)

lazy val core = (project in file("core"))
.enablePlugins(DevOopsGitReleasePlugin)
.settings(
Expand Down Expand Up @@ -114,7 +109,7 @@ lazy val core = (project in file("core"))
, testFrameworks ++= Seq(TestFramework("hedgehog.sbt.Framework"))
/* Bintray { */
, bintrayPackageLabels := Seq("Scala", "Functional Programming", "FP")
, bintrayVcsUrl := Some("""git@github.com:Kevin-Lee/just-fp.git""")
, bintrayVcsUrl := Some(s"""git@github.com:$GitHubUsername/$RepoName.git""")
, licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
/* } Bintray */

Expand All @@ -131,45 +126,68 @@ lazy val core = (project in file("core"))
/* } Coveralls */
)

lazy val docDir = file("docs")
lazy val docs = (project in docDir)
.enablePlugins(MicrositesPlugin)
.settings(noPublish)
.settings(
name := prefixedProjectName("docs")
/* microsites { */
, micrositeName := prefixedProjectName("")
, micrositeAuthor := "Kevin Lee"
, micrositeHomepage := "https://blog.kevinlee.io"
, micrositeDescription := "Just FP"
, micrositeGithubOwner := "Kevin-Lee"
, micrositeGithubRepo := "just-fp"
, micrositeBaseUrl := "/just-fp"
, micrositeDocumentationUrl := s"${micrositeBaseUrl.value}/docs"
, micrositePushSiteWith := GitHub4s
, micrositeGithubToken := sys.env.get("GITHUB_TOKEN")
// , micrositeTheme := "pattern"
, micrositeHighlightTheme := "atom-one-light"
, micrositeGitterChannel := false
, micrositeGithubLinks := false
, micrositeShareOnSocial := false
, micrositeHighlightLanguages ++= Seq("shell")
//lazy val docDir = file("docs")
//lazy val docs = (project in docDir)
// .enablePlugins(MicrositesPlugin)
// .settings(noPublish)
// .settings(
// name := prefixedProjectName("docs")
// /* microsites { */
// , micrositeName := prefixedProjectName("")
// , micrositeAuthor := "Kevin Lee"
// , micrositeHomepage := "https://blog.kevinlee.io"
// , micrositeDescription := "Just FP"
// , micrositeGithubOwner := "Kevin-Lee"
// , micrositeGithubRepo := "just-fp"
// , micrositeBaseUrl := "/just-fp"
// , micrositeDocumentationUrl := s"${micrositeBaseUrl.value}/docs"
// , micrositePushSiteWith := GitHub4s
// , micrositeGithubToken := sys.env.get("GITHUB_TOKEN")
//// , micrositeTheme := "pattern"
// , micrositeHighlightTheme := "atom-one-light"
// , micrositeGitterChannel := false
// , micrositeGithubLinks := false
// , micrositeShareOnSocial := false
// , micrositeHighlightLanguages ++= Seq("shell")
//
// , micrositeConfigYaml := ConfigYml(
// yamlPath = Some(docDir / "microsite" / "_config.yml")
// )
// , micrositeImgDirectory := docDir / "microsite" / "img"
// , micrositeCssDirectory := docDir / "microsite" / "css"
// , micrositeSassDirectory := docDir / "microsite" / "sass"
// , micrositeJsDirectory := docDir / "microsite" / "js"
// , micrositeExternalLayoutsDirectory := docDir / "microsite" / "layouts"
// , micrositeExternalIncludesDirectory := docDir / "microsite" / "includes"
// , micrositeDataDirectory := docDir / "microsite" / "data"
// , micrositeStaticDirectory := docDir / "microsite" / "static"
// , micrositeExtraMdFilesOutput := docDir / "microsite" / "extra_md"
// , micrositePluginsDirectory := docDir / "microsite" / "plugins"
//
// /* } microsites */
//
// )
// .dependsOn(core)

, micrositeConfigYaml := ConfigYml(
yamlPath = Some(docDir / "microsite" / "_config.yml")
)
, micrositeImgDirectory := docDir / "microsite" / "img"
, micrositeCssDirectory := docDir / "microsite" / "css"
, micrositeSassDirectory := docDir / "microsite" / "sass"
, micrositeJsDirectory := docDir / "microsite" / "js"
, micrositeExternalLayoutsDirectory := docDir / "microsite" / "layouts"
, micrositeExternalIncludesDirectory := docDir / "microsite" / "includes"
, micrositeDataDirectory := docDir / "microsite" / "data"
, micrositeStaticDirectory := docDir / "microsite" / "static"
, micrositeExtraMdFilesOutput := docDir / "microsite" / "extra_md"
, micrositePluginsDirectory := docDir / "microsite" / "plugins"
lazy val docs = (project in file("generated-docs"))
.enablePlugins(MdocPlugin, DocusaurPlugin)
.settings(
name := prefixedProjectName("docs")

/* } microsites */
, docusaurDir := (ThisBuild / baseDirectory).value / "website"
, docusaurBuildDir := docusaurDir.value / "build"

, gitHubPagesOrgName := GitHubUsername
, gitHubPagesRepoName := RepoName
)
.settings(noPublish)
.dependsOn(core)

lazy val justFp = (project in file("."))
.enablePlugins(DevOopsGitReleasePlugin)
.settings(
name := prefixedProjectName("")
, description := "Just FP Lib"
)
.settings(noPublish)
.aggregate(core, docs)
2 changes: 2 additions & 0 deletions project/plugins.sbt
Expand Up @@ -11,3 +11,5 @@ addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")
addSbtPlugin("io.kevinlee" % "sbt-devoops" % "1.0.3")

addSbtPlugin("com.47deg" % "sbt-microsites" % "1.1.4")

addSbtPlugin("io.kevinlee" % "sbt-docusaur" % "0.1.3")
1 change: 1 addition & 0 deletions website/static/CNAME
@@ -0,0 +1 @@
just-fp.kevinly.dev

0 comments on commit bb42a04

Please sign in to comment.