Skip to content

Commit 39570c0

Browse files
committed
Doc setup with typelevel-site
1 parent 8b3b865 commit 39570c0

File tree

3 files changed

+42
-123
lines changed

3 files changed

+42
-123
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ jobs:
8181
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
8282
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
8383

84-
- if: matrix.scala == '2.13'
85-
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' docs/mdoc
86-
8784
- name: Make target directories
8885
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
8986
run: mkdir -p modules/core/.native/target modules/core/.js/target modules/core/.jvm/target project/target
@@ -280,109 +277,55 @@ jobs:
280277
modules-ignore: rootjs_2.13 rootjs_3 rootjs_2.12 docs_2.13 docs_3 docs_2.12 rootjvm_2.13 rootjvm_3 rootjvm_2.12 rootnative_2.13 rootnative_3 rootnative_2.12
281278
configs-ignore: test scala-tool scala-doc-tool test-internal
282279

283-
docs:
284-
name: Deploy docs
285-
needs: [publish]
286-
if: always() && needs.build.result == 'success' && (needs.publish.result == 'success' || github.ref == 'refs/heads/docs-deploy')
280+
site:
281+
name: Generate Site
287282
strategy:
288283
matrix:
289284
os: [ubuntu-22.04]
290-
scala: [2.13.16]
291-
java: [temurin@8]
285+
java: [temurin@11]
292286
runs-on: ${{ matrix.os }}
293287
steps:
294-
- name: Download target directories (2.13, rootJS)
295-
uses: actions/download-artifact@v4
296-
with:
297-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS
298-
299-
- name: Inflate target directories (2.13, rootJS)
300-
run: |
301-
tar xf targets.tar
302-
rm targets.tar
303-
304-
- name: Download target directories (2.13, rootJVM)
305-
uses: actions/download-artifact@v4
306-
with:
307-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM
308-
309-
- name: Inflate target directories (2.13, rootJVM)
310-
run: |
311-
tar xf targets.tar
312-
rm targets.tar
313-
314-
- name: Download target directories (2.13, rootNative)
315-
uses: actions/download-artifact@v4
316-
with:
317-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative
318-
319-
- name: Inflate target directories (2.13, rootNative)
320-
run: |
321-
tar xf targets.tar
322-
rm targets.tar
323-
324-
- name: Download target directories (3, rootJS)
325-
uses: actions/download-artifact@v4
326-
with:
327-
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS
328-
329-
- name: Inflate target directories (3, rootJS)
330-
run: |
331-
tar xf targets.tar
332-
rm targets.tar
333-
334-
- name: Download target directories (3, rootJVM)
335-
uses: actions/download-artifact@v4
336-
with:
337-
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM
338-
339-
- name: Inflate target directories (3, rootJVM)
340-
run: |
341-
tar xf targets.tar
342-
rm targets.tar
343-
344-
- name: Download target directories (3, rootNative)
345-
uses: actions/download-artifact@v4
288+
- name: Checkout current branch (full)
289+
uses: actions/checkout@v4
346290
with:
347-
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative
291+
fetch-depth: 0
348292

349-
- name: Inflate target directories (3, rootNative)
350-
run: |
351-
tar xf targets.tar
352-
rm targets.tar
293+
- name: Setup sbt
294+
uses: sbt/setup-sbt@v1
353295

354-
- name: Download target directories (2.12, rootJS)
355-
uses: actions/download-artifact@v4
296+
- name: Setup Java (temurin@8)
297+
id: setup-java-temurin-8
298+
if: matrix.java == 'temurin@8'
299+
uses: actions/setup-java@v4
356300
with:
357-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS
301+
distribution: temurin
302+
java-version: 8
303+
cache: sbt
358304

359-
- name: Inflate target directories (2.12, rootJS)
360-
run: |
361-
tar xf targets.tar
362-
rm targets.tar
305+
- name: sbt update
306+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
307+
run: sbt +update
363308

364-
- name: Download target directories (2.12, rootJVM)
365-
uses: actions/download-artifact@v4
309+
- name: Setup Java (temurin@11)
310+
id: setup-java-temurin-11
311+
if: matrix.java == 'temurin@11'
312+
uses: actions/setup-java@v4
366313
with:
367-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM
368-
369-
- name: Inflate target directories (2.12, rootJVM)
370-
run: |
371-
tar xf targets.tar
372-
rm targets.tar
314+
distribution: temurin
315+
java-version: 11
316+
cache: sbt
373317

374-
- name: Download target directories (2.12, rootNative)
375-
uses: actions/download-artifact@v4
376-
with:
377-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootNative
318+
- name: sbt update
319+
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
320+
run: sbt +update
378321

379-
- name: Inflate target directories (2.12, rootNative)
380-
run: |
381-
tar xf targets.tar
382-
rm targets.tar
322+
- name: Generate site
323+
run: sbt docs/tlSite
383324

384-
- name: Deploy docs
385-
uses: peaceiris/actions-gh-pages@v4
325+
- name: Publish site
326+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
327+
uses: peaceiris/[email protected]
386328
with:
387-
publish_dir: ./target/website
388329
github_token: ${{ secrets.GITHUB_TOKEN }}
330+
publish_dir: mdoc/target/docs/site
331+
keep_files: true

build.sbt

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,37 +60,12 @@ lazy val docs = project
6060
.map(v => s"- **$v**")
6161
.mkString("\n")
6262
),
63-
githubWorkflowArtifactUpload := false,
63+
laikaSite := {
64+
sbt.IO.copyDirectory(mdocOut.value, (laikaSite / target).value)
65+
Set.empty
66+
},
67+
tlJdkRelease := None,
6468
tlFatalWarnings := false
6569
)
6670
.dependsOn(core.jvm)
67-
.enablePlugins(MdocPlugin, NoPublishPlugin)
68-
69-
ThisBuild / githubWorkflowBuildPostamble ++= List(
70-
WorkflowStep.Sbt(
71-
List("docs/mdoc"),
72-
cond = Some(s"matrix.scala == '2.13'")
73-
)
74-
)
75-
76-
ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
77-
id = "docs",
78-
name = "Deploy docs",
79-
needs = List("publish"),
80-
cond = """
81-
| always() &&
82-
| needs.build.result == 'success' &&
83-
| (needs.publish.result == 'success' || github.ref == 'refs/heads/docs-deploy')
84-
""".stripMargin.trim.linesIterator.mkString.some,
85-
steps = githubWorkflowGeneratedDownloadSteps.value.toList :+
86-
WorkflowStep.Use(
87-
UseRef.Public("peaceiris", "actions-gh-pages", "v4"),
88-
name = Some(s"Deploy docs"),
89-
params = Map(
90-
"publish_dir" -> "./target/website",
91-
"github_token" -> "${{ secrets.GITHUB_TOKEN }}"
92-
)
93-
),
94-
scalas = List(Scala213),
95-
javas = githubWorkflowJavaVersions.value.toList
96-
)
71+
.enablePlugins(TypelevelSitePlugin)

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.8.0")
2+
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.8.0")
23
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.7.1")
34
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2")
45
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")

0 commit comments

Comments
 (0)