Skip to content

Commit 885bef1

Browse files
committed
Typelevel site setup
1 parent 70fffff commit 885bef1

File tree

4 files changed

+64
-119
lines changed

4 files changed

+64
-119
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
matrix:
3030
os: [ubuntu-22.04]
3131
scala: [2.13, 3, 2.12]
32-
java: [temurin@11]
32+
java: [temurin@8]
3333
project: [rootJS, rootJVM]
3434
runs-on: ${{ matrix.os }}
3535
timeout-minutes: 60
@@ -42,24 +42,24 @@ jobs:
4242
- name: Setup sbt
4343
uses: sbt/setup-sbt@v1
4444

45-
- name: Setup Java (temurin@11)
46-
id: setup-java-temurin-11
47-
if: matrix.java == 'temurin@11'
45+
- name: Setup Java (temurin@8)
46+
id: setup-java-temurin-8
47+
if: matrix.java == 'temurin@8'
4848
uses: actions/setup-java@v4
4949
with:
5050
distribution: temurin
51-
java-version: 11
51+
java-version: 8
5252
cache: sbt
5353

5454
- name: sbt update
55-
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
55+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
5656
run: sbt +update
5757

5858
- name: Check that workflows are up to date
5959
run: sbt githubWorkflowCheck
6060

6161
- name: Check headers and formatting
62-
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
62+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
6363
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
6464

6565
- name: scalaJSLink
@@ -70,16 +70,13 @@ jobs:
7070
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
7171

7272
- name: Check binary compatibility
73-
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
73+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
7474
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
7575

7676
- name: Generate API documentation
77-
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
77+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
7878
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
7979

80-
- if: matrix.scala == '2.13.16'
81-
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' docs/mdoc
82-
8380
- name: Make target directories
8481
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
8582
run: mkdir -p modules/core/js/target modules/core/jvm/target project/target
@@ -102,7 +99,7 @@ jobs:
10299
strategy:
103100
matrix:
104101
os: [ubuntu-22.04]
105-
java: [temurin@11]
102+
java: [temurin@8]
106103
runs-on: ${{ matrix.os }}
107104
steps:
108105
- name: Checkout current branch (full)
@@ -113,17 +110,17 @@ jobs:
113110
- name: Setup sbt
114111
uses: sbt/setup-sbt@v1
115112

116-
- name: Setup Java (temurin@11)
117-
id: setup-java-temurin-11
118-
if: matrix.java == 'temurin@11'
113+
- name: Setup Java (temurin@8)
114+
id: setup-java-temurin-8
115+
if: matrix.java == 'temurin@8'
119116
uses: actions/setup-java@v4
120117
with:
121118
distribution: temurin
122-
java-version: 11
119+
java-version: 8
123120
cache: sbt
124121

125122
- name: sbt update
126-
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
123+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
127124
run: sbt +update
128125

129126
- name: Download target directories (2.13, rootJS)
@@ -216,7 +213,7 @@ jobs:
216213
strategy:
217214
matrix:
218215
os: [ubuntu-22.04]
219-
java: [temurin@11]
216+
java: [temurin@8]
220217
runs-on: ${{ matrix.os }}
221218
steps:
222219
- name: Checkout current branch (full)
@@ -227,17 +224,17 @@ jobs:
227224
- name: Setup sbt
228225
uses: sbt/setup-sbt@v1
229226

230-
- name: Setup Java (temurin@11)
231-
id: setup-java-temurin-11
232-
if: matrix.java == 'temurin@11'
227+
- name: Setup Java (temurin@8)
228+
id: setup-java-temurin-8
229+
if: matrix.java == 'temurin@8'
233230
uses: actions/setup-java@v4
234231
with:
235232
distribution: temurin
236-
java-version: 11
233+
java-version: 8
237234
cache: sbt
238235

239236
- name: sbt update
240-
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
237+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
241238
run: sbt +update
242239

243240
- name: Submit Dependencies
@@ -246,79 +243,55 @@ jobs:
246243
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 benchmark_2.13 benchmark_3 benchmark_2.12
247244
configs-ignore: test scala-tool scala-doc-tool test-internal
248245

249-
docs:
250-
name: Deploy docs
251-
needs: [publish]
252-
if: always() && needs.build.result == 'success' && (needs.publish.result == 'success' || github.ref == 'refs/heads/docs-deploy')
246+
site:
247+
name: Generate Site
253248
strategy:
254249
matrix:
255250
os: [ubuntu-22.04]
256-
scala: [2.13.16]
257251
java: [temurin@11]
258252
runs-on: ${{ matrix.os }}
259253
steps:
260-
- name: Download target directories (2.13, rootJS)
261-
uses: actions/download-artifact@v4
262-
with:
263-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS
264-
265-
- name: Inflate target directories (2.13, rootJS)
266-
run: |
267-
tar xf targets.tar
268-
rm targets.tar
269-
270-
- name: Download target directories (2.13, rootJVM)
271-
uses: actions/download-artifact@v4
272-
with:
273-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM
274-
275-
- name: Inflate target directories (2.13, rootJVM)
276-
run: |
277-
tar xf targets.tar
278-
rm targets.tar
279-
280-
- name: Download target directories (3, rootJS)
281-
uses: actions/download-artifact@v4
254+
- name: Checkout current branch (full)
255+
uses: actions/checkout@v4
282256
with:
283-
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS
257+
fetch-depth: 0
284258

285-
- name: Inflate target directories (3, rootJS)
286-
run: |
287-
tar xf targets.tar
288-
rm targets.tar
259+
- name: Setup sbt
260+
uses: sbt/setup-sbt@v1
289261

290-
- name: Download target directories (3, rootJVM)
291-
uses: actions/download-artifact@v4
262+
- name: Setup Java (temurin@8)
263+
id: setup-java-temurin-8
264+
if: matrix.java == 'temurin@8'
265+
uses: actions/setup-java@v4
292266
with:
293-
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM
267+
distribution: temurin
268+
java-version: 8
269+
cache: sbt
294270

295-
- name: Inflate target directories (3, rootJVM)
296-
run: |
297-
tar xf targets.tar
298-
rm targets.tar
271+
- name: sbt update
272+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
273+
run: sbt +update
299274

300-
- name: Download target directories (2.12, rootJS)
301-
uses: actions/download-artifact@v4
275+
- name: Setup Java (temurin@11)
276+
id: setup-java-temurin-11
277+
if: matrix.java == 'temurin@11'
278+
uses: actions/setup-java@v4
302279
with:
303-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS
304-
305-
- name: Inflate target directories (2.12, rootJS)
306-
run: |
307-
tar xf targets.tar
308-
rm targets.tar
280+
distribution: temurin
281+
java-version: 11
282+
cache: sbt
309283

310-
- name: Download target directories (2.12, rootJVM)
311-
uses: actions/download-artifact@v4
312-
with:
313-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM
284+
- name: sbt update
285+
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
286+
run: sbt +update
314287

315-
- name: Inflate target directories (2.12, rootJVM)
316-
run: |
317-
tar xf targets.tar
318-
rm targets.tar
288+
- name: Generate site
289+
run: sbt docs/tlSite
319290

320-
- name: Deploy docs
321-
uses: peaceiris/actions-gh-pages@v4
291+
- name: Publish site
292+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
293+
uses: peaceiris/[email protected]
322294
with:
323-
publish_dir: ./target/website
324295
github_token: ${{ secrets.GITHUB_TOKEN }}
296+
publish_dir: mdoc/target/docs/site
297+
keep_files: true

build.sbt

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -83,48 +83,20 @@ lazy val jsdocs = project
8383
lazy val docs = project
8484
.in(file("mdoc"))
8585
.settings(
86-
mdocJS := Some(jsdocs),
8786
mdocIn := file("docs"),
8887
mdocOut := file("target/website"),
8988
mdocVariables := Map(
90-
"version" -> version.value,
89+
"version" -> tlLatestVersion.value.getOrElse(version.value),
9190
"scalaVersions" -> crossScalaVersions.value
9291
.map(v => s"- **$v**")
9392
.mkString("\n")
9493
),
95-
githubWorkflowArtifactUpload := false,
94+
laikaSite := {
95+
sbt.IO.copyDirectory(mdocOut.value, (laikaSite / target).value)
96+
Set.empty
97+
},
98+
tlJdkRelease := None,
9699
tlFatalWarnings := false
97100
)
98101
.dependsOn(core.jvm)
99-
.enablePlugins(MdocPlugin, NoPublishPlugin)
100-
101-
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
102-
103-
ThisBuild / githubWorkflowBuildPostamble ++= List(
104-
WorkflowStep.Sbt(
105-
List("docs/mdoc"),
106-
cond = Some(s"matrix.scala == '$Scala213'")
107-
)
108-
)
109-
110-
ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
111-
id = "docs",
112-
name = "Deploy docs",
113-
needs = List("publish"),
114-
cond = """
115-
| always() &&
116-
| needs.build.result == 'success' &&
117-
| (needs.publish.result == 'success' || github.ref == 'refs/heads/docs-deploy')
118-
""".stripMargin.trim.linesIterator.mkString.some,
119-
steps = githubWorkflowGeneratedDownloadSteps.value.toList :+
120-
WorkflowStep.Use(
121-
UseRef.Public("peaceiris", "actions-gh-pages", "v4"),
122-
name = Some(s"Deploy docs"),
123-
params = Map(
124-
"publish_dir" -> "./target/website",
125-
"github_token" -> "${{ secrets.GITHUB_TOKEN }}"
126-
)
127-
),
128-
scalas = List(Scala213),
129-
javas = githubWorkflowJavaVersions.value.toList
130-
)
102+
.enablePlugins(TypelevelSitePlugin)

dev-flow.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ the sidebar needs to have a specific format:
4444

4545
Push a `vx.y.z` tag on `main` to release. It will fail if semver isn't
4646
respected wrt bincompat.
47-
Docs are released automatically on each code release, if you need a
48-
docs-only deploy, (force) push `main` to the `docs-deploy` branch.
47+
Docs are released automatically on each push to `main.`
4948

5049

5150
## Links

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)