Skip to content

Commit 6b4be66

Browse files
authored
Merge pull request #2819 from armanbilge/topic/sbt-typelevel-site
Use sbt-typelevel-site plugin to build/publish microsite
2 parents 45dab3c + 1739e7f commit 6b4be66

File tree

4 files changed

+44
-111
lines changed

4 files changed

+44
-111
lines changed

.github/workflows/ci.yml

+28-64
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,13 @@ jobs:
8585
cd scalafix
8686
sbt testCI
8787
88-
- if: matrix.scala == '2.13.8' && matrix.project == 'rootJVM'
89-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' microsite/mdoc
90-
9188
- name: Make target directories
9289
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/series/2.5.x')
93-
run: mkdir -p target node/js/target protocols/js/target .js/target core/js/target core/jvm/target .jvm/target .native/target scodec/jvm/target scodec/js/target io/js/target reactive-streams/target io/jvm/target protocols/jvm/target benchmark/target project/target
90+
run: mkdir -p target node/js/target protocols/js/target .js/target core/js/target mdoc/target core/jvm/target .jvm/target .native/target scodec/jvm/target scodec/js/target io/js/target reactive-streams/target io/jvm/target protocols/jvm/target benchmark/target project/target
9491

9592
- name: Compress target directories
9693
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/series/2.5.x')
97-
run: tar cf targets.tar target node/js/target protocols/js/target .js/target core/js/target core/jvm/target .jvm/target .native/target scodec/jvm/target scodec/js/target io/js/target reactive-streams/target io/jvm/target protocols/jvm/target benchmark/target project/target
94+
run: tar cf targets.tar target node/js/target protocols/js/target .js/target core/js/target mdoc/target core/jvm/target .jvm/target .native/target scodec/jvm/target scodec/js/target io/js/target reactive-streams/target io/jvm/target protocols/jvm/target benchmark/target project/target
9895

9996
- name: Upload target directories
10097
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/series/2.5.x')
@@ -213,78 +210,45 @@ jobs:
213210
run: sbt '++${{ matrix.scala }}' tlRelease
214211

215212
site:
216-
name: Deploy site
217-
needs: [publish]
218-
if: always() && needs.build.result == 'success' && (needs.publish.result == 'success' && github.ref == 'refs/heads/main')
213+
name: Generate Site
219214
strategy:
220215
matrix:
221216
os: [ubuntu-latest]
222217
scala: [2.13.8]
223218
java: [temurin@17]
224219
runs-on: ${{ matrix.os }}
225220
steps:
226-
- name: Download target directories (3.1.1, rootJS)
227-
uses: actions/download-artifact@v2
228-
with:
229-
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJS
230-
231-
- name: Inflate target directories (3.1.1, rootJS)
232-
run: |
233-
tar xf targets.tar
234-
rm targets.tar
235-
236-
- name: Download target directories (3.1.1, rootJVM)
237-
uses: actions/download-artifact@v2
238-
with:
239-
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJVM
240-
241-
- name: Inflate target directories (3.1.1, rootJVM)
242-
run: |
243-
tar xf targets.tar
244-
rm targets.tar
245-
246-
- name: Download target directories (2.12.15, rootJS)
247-
uses: actions/download-artifact@v2
248-
with:
249-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJS
250-
251-
- name: Inflate target directories (2.12.15, rootJS)
252-
run: |
253-
tar xf targets.tar
254-
rm targets.tar
255-
256-
- name: Download target directories (2.12.15, rootJVM)
257-
uses: actions/download-artifact@v2
221+
- name: Checkout current branch (full)
222+
uses: actions/checkout@v2
258223
with:
259-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM
260-
261-
- name: Inflate target directories (2.12.15, rootJVM)
262-
run: |
263-
tar xf targets.tar
264-
rm targets.tar
224+
fetch-depth: 0
265225

266-
- name: Download target directories (2.13.8, rootJS)
267-
uses: actions/download-artifact@v2
226+
- name: Setup Java (temurin@17)
227+
if: matrix.java == 'temurin@17'
228+
uses: actions/setup-java@v2
268229
with:
269-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJS
270-
271-
- name: Inflate target directories (2.13.8, rootJS)
272-
run: |
273-
tar xf targets.tar
274-
rm targets.tar
230+
distribution: temurin
231+
java-version: 17
275232

276-
- name: Download target directories (2.13.8, rootJVM)
277-
uses: actions/download-artifact@v2
233+
- name: Cache sbt
234+
uses: actions/cache@v2
278235
with:
279-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM
236+
path: |
237+
~/.sbt
238+
~/.ivy2/cache
239+
~/.coursier/cache/v1
240+
~/.cache/coursier/v1
241+
~/AppData/Local/Coursier/Cache/v1
242+
~/Library/Caches/Coursier/v1
243+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
280244

281-
- name: Inflate target directories (2.13.8, rootJVM)
282-
run: |
283-
tar xf targets.tar
284-
rm targets.tar
245+
- name: Generate site
246+
run: sbt '++${{ matrix.scala }}' microsite/tlSite
285247

286-
- name: Deploy site
287-
uses: peaceiris/actions-gh-pages@v3
248+
- name: Publish site
249+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
250+
uses: peaceiris/[email protected]
288251
with:
289-
publish_dir: ./target/website
290252
github_token: ${{ secrets.GITHUB_TOKEN }}
253+
publish_dir: mdoc/target/docs/site
254+
keep_files: true

build.sbt

+5-38
Original file line numberDiff line numberDiff line change
@@ -339,44 +339,11 @@ lazy val microsite = project
339339
.in(file("mdoc"))
340340
.settings(
341341
mdocIn := file("site"),
342-
mdocOut := file("target/website"),
343-
mdocVariables := Map(
344-
"version" -> version.value,
345-
"scalaVersions" -> crossScalaVersions.value
346-
.map(v => s"- **$v**")
347-
.mkString("\n")
348-
),
349-
githubWorkflowArtifactUpload := false,
342+
laikaSite := {
343+
sbt.IO.copyDirectory(mdocOut.value, (laikaSite / target).value)
344+
Set.empty
345+
},
350346
tlFatalWarningsInCi := false
351347
)
352348
.dependsOn(coreJVM, io.jvm, reactiveStreams, scodec.jvm)
353-
.enablePlugins(MdocPlugin, NoPublishPlugin)
354-
355-
ThisBuild / githubWorkflowBuildPostamble ++= List(
356-
WorkflowStep.Sbt(
357-
List("microsite/mdoc"),
358-
cond = Some(s"matrix.scala == '$NewScala' && matrix.project == 'rootJVM'")
359-
)
360-
)
361-
362-
ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
363-
id = "site",
364-
name = "Deploy site",
365-
needs = List("publish"),
366-
javas = (ThisBuild / githubWorkflowJavaVersions).value.toList,
367-
scalas = (ThisBuild / scalaVersion).value :: Nil,
368-
cond = """
369-
| always() &&
370-
| needs.build.result == 'success' &&
371-
| (needs.publish.result == 'success' && github.ref == 'refs/heads/main')
372-
""".stripMargin.trim.linesIterator.mkString.some,
373-
steps = githubWorkflowGeneratedDownloadSteps.value.toList :+
374-
WorkflowStep.Use(
375-
UseRef.Public("peaceiris", "actions-gh-pages", "v3"),
376-
name = Some(s"Deploy site"),
377-
params = Map(
378-
"publish_dir" -> "./target/website",
379-
"github_token" -> "${{ secrets.GITHUB_TOKEN }}"
380-
)
381-
)
382-
)
349+
.enablePlugins(TypelevelSitePlugin)

project/plugins.sbt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.5")
1+
val sbtTypelevelVersion = "0.4.5"
2+
addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion)
3+
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)
24
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
35
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
46
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

site/getstarted/install.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# Install
22

3-
The latest version for Cats Effect 3 is `3.2.0`, which supports Cats Effect 3 and is cross built for Scala 2.12, 2.13, and 3.0.
3+
The latest version for Cats Effect 3 is `@VERSION@`, which supports Cats Effect 3 and is cross built for Scala 2.12, 2.13, and 3.0.
44

55
The latest version for Cats Effect 2 is `2.5.10`, which supports Cats Effect 2 and is similarly cross built for various Scala versions.
66

77
### Dependencies <!-- {docsify-ignore} -->
88

99
```
1010
// available for 2.12, 2.13, 3.0
11-
libraryDependencies += "co.fs2" %% "fs2-core" % "<version>"
11+
libraryDependencies += "co.fs2" %% "fs2-core" % "@VERSION@"
1212
1313
// optional I/O library
14-
libraryDependencies += "co.fs2" %% "fs2-io" % "<version>"
14+
libraryDependencies += "co.fs2" %% "fs2-io" % "@VERSION@"
1515
1616
// optional reactive streams interop
17-
libraryDependencies += "co.fs2" %% "fs2-reactive-streams" % "<version>"
17+
libraryDependencies += "co.fs2" %% "fs2-reactive-streams" % "@VERSION@"
1818
1919
// optional scodec interop
20-
libraryDependencies += "co.fs2" %% "fs2-scodec" % "<version>"
20+
libraryDependencies += "co.fs2" %% "fs2-scodec" % "@VERSION@"
2121
```
2222

2323
The fs2-core as well as fs2-io and fs2-scodec libraries are also supported on Scala.js:
2424

2525
```
26-
libraryDependencies += "co.fs2" %%% "fs2-core" % "<version>"
27-
libraryDependencies += "co.fs2" %%% "fs2-io" % "<version>" // Node.js only
28-
libraryDependencies += "co.fs2" %%% "fs2-scodec" % "<version>"
26+
libraryDependencies += "co.fs2" %%% "fs2-core" % "@VERSION@"
27+
libraryDependencies += "co.fs2" %%% "fs2-io" % "@VERSION@" // Node.js only
28+
libraryDependencies += "co.fs2" %%% "fs2-scodec" % "@VERSION@"
2929
```
3030

3131
Release notes for each release are available on [Github](https://github.com/typelevel/fs2/releases/).

0 commit comments

Comments
 (0)