Skip to content

Commit 1e4a711

Browse files
committed
Add a "side by side" site distribution to the demo and publish it to GitHub Pages
A corresponding commit: huanshankeji/gradle-common@642cdea
1 parent bd53c1d commit 1e4a711

File tree

5 files changed

+77
-6
lines changed

5 files changed

+77
-6
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,23 @@ jobs:
3030
uses: actions/checkout@v4
3131
- name: Setup Pages
3232
uses: actions/configure-pages@v5
33-
- name: Build with Jekyll
34-
uses: actions/jekyll-build-pages@v1
33+
34+
- name: Set up JDK 8
35+
uses: actions/setup-java@v4
3536
with:
36-
source: ./
37-
destination: ./_site
37+
java-version: "8"
38+
distribution: "temurin"
39+
40+
- name: Setup Gradle
41+
uses: gradle/actions/setup-gradle@v4
42+
43+
- name: Build the distribution with Gradle Wrapper
44+
run: ./gradlew :demo:sideBySideBrowserDistribution
45+
3846
- name: Upload artifact
3947
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: demo/build/dist/sideBySide/productionExecutable/
4050

4151
# Deployment job
4252
deploy:

demo/build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,19 @@ android {
119119
debugImplementation(compose.uiTooling)
120120
}
121121
}
122+
123+
val jsBrowserDistribution by tasks.getting(Copy::class)
124+
val wasmJsBrowserDistribution by tasks.getting(Copy::class)
125+
126+
tasks.register<Sync>("sideBySideBrowserDistribution") {
127+
group = "kotlin browser"
128+
129+
into(layout.buildDirectory.dir("dist/sideBySide/productionExecutable"))
130+
from(jsBrowserDistribution) {
131+
into("js-dom")
132+
}
133+
from(wasmJsBrowserDistribution) {
134+
into("wasm-js-canvas")
135+
}
136+
from(projectDir.resolve("side-by-side-site"))
137+
}

demo/side-by-side-site/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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>Side by side - Compose Multiplatform Material demo</title>
8+
<meta content="width=device-width, initial-scale=1" name="viewport">
9+
<style>
10+
body {
11+
margin: 0;
12+
height: 100vh;
13+
}
14+
15+
.row {
16+
display: flex;
17+
flex-direction: row;
18+
height: 100%;
19+
}
20+
21+
.column {
22+
display: flex;
23+
flex-direction: column;
24+
}
25+
26+
.flex-grow-1 {
27+
flex-grow: 1;
28+
}
29+
</style>
30+
</head>
31+
32+
<body>
33+
<div class="row">
34+
<div class="flex-grow-1 column">
35+
<h2>JS DOM / Compose HTML</h2>
36+
<embed class="flex-grow-1" src="js-dom/index.html">
37+
</div>
38+
<div class="flex-grow-1 column">
39+
<h2>Wasm JS canvas / <code>androidx.compose</code></h2>
40+
<embed class="flex-grow-1" src="wasm-js-canvas/index.html">
41+
</div>
42+
</div>
43+
</body>
44+
45+
</html>

demo/src/jsMain/resources/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
66
<meta charset="UTF-8">
7-
<title>Compose Multiplatform Material demo</title>
7+
<title>JS DOM - Compose Multiplatform Material demo</title>
88
<meta content="width=device-width, initial-scale=1" name="viewport">
99
<style>
1010
body {

demo/src/wasmJsMain/resources/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Compose Multiplatform Material demo</title>
7+
<title>Wasm JS canvas - Compose Multiplatform Material demo</title>
88
<link type="text/css" rel="stylesheet" href="styles.css">
99
<script src="app.js" type="application/javascript"></script>
1010
</head>

0 commit comments

Comments
 (0)