Skip to content

Commit a1f4168

Browse files
committed
Add a site that includes both the API documentation and the demo, including an index.html and a Gradle task to generate the site, and update the workflow file correspondingly
1 parent 314a8e1 commit a1f4168

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

.github/workflows/dokka-gh-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy the API documentation to GitHub Pages with Dokka
1+
name: Deploy the site to GitHub Pages
22

33
on:
44
push:
@@ -41,12 +41,12 @@ jobs:
4141
uses: gradle/actions/setup-gradle@v4
4242

4343
- name: Build the distribution with Gradle Wrapper
44-
run: ./gradlew :dokkaGeneratePublicationHtml
44+
run: ./gradlew :generateSite
4545

4646
- name: Upload artifact
4747
uses: actions/upload-pages-artifact@v3
4848
with:
49-
path: build/dokka/html/
49+
path: build/site/
5050

5151
# Deployment job
5252
deploy:

build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.dokka.gradle.tasks.DokkaGeneratePublicationTask
2+
13
tasks.wrapper {
24
distributionType = Wrapper.DistributionType.ALL
35
}
@@ -14,3 +16,15 @@ dependencies {
1416
dokka(project(":$it"))
1517
}
1618
}
19+
20+
val dokkaGeneratePublicationHtml by tasks.getting(DokkaGeneratePublicationTask::class)
21+
tasks.register<Sync>("generateSite") {
22+
group = "site"
23+
24+
val destRootDir = layout.buildDirectory.dir("site")
25+
into(destRootDir)
26+
from(dokkaGeneratePublicationHtml) {
27+
into("api-documentation")
28+
}
29+
from(layout.projectDirectory.dir("site"))
30+
}

site/index.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6+
<meta charset="UTF-8">
7+
<title>Compose HTML Material</title>
8+
<meta content="width=device-width, initial-scale=1" name="viewport">
9+
<style>
10+
body {
11+
margin: 0;
12+
height: 100vh;
13+
display: flex;
14+
justify-content: center;
15+
align-items: center;
16+
}
17+
</style>
18+
</head>
19+
20+
<body>
21+
<ul>
22+
<li><a href="api-documentation/index.html">API documentation</a></li>
23+
<li>
24+
<a href="https://huanshankeji.github.io/compose-multiplatform-material/">
25+
Compose Multiplatform Material side-by-side demo
26+
</a>
27+
</li>
28+
</ul>
29+
</body>
30+
31+
</html>

0 commit comments

Comments
 (0)