diff --git a/.github/workflows/demo-gh-pages.yml b/.github/workflows/demo-gh-pages.yml new file mode 100644 index 00000000..dbbaa62b --- /dev/null +++ b/.github/workflows/demo-gh-pages.yml @@ -0,0 +1,61 @@ +name: Deploy the demo to GitHub Pages + +on: + push: + branches: [ "release" ] + pull_request: + branches: [ "release" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: "17" + distribution: "temurin" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build the distribution with Gradle Wrapper + run: ./gradlew :demo:sideBySideBrowserDistribution + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: demo/build/dist/sideBySide/productionExecutable/ + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts index 227ec7e9..df384517 100644 --- a/demo/build.gradle.kts +++ b/demo/build.gradle.kts @@ -119,3 +119,19 @@ android { debugImplementation(compose.uiTooling) } } + +val jsBrowserDistribution by tasks.getting(Copy::class) +val wasmJsBrowserDistribution by tasks.getting(Copy::class) + +tasks.register("sideBySideBrowserDistribution") { + group = "kotlin browser" + + into(layout.buildDirectory.dir("dist/sideBySide/productionExecutable")) + from(jsBrowserDistribution) { + into("js-dom") + } + from(wasmJsBrowserDistribution) { + into("wasm-js-canvas") + } + from(projectDir.resolve("side-by-side-site")) +} diff --git a/demo/side-by-side-site/index.html b/demo/side-by-side-site/index.html new file mode 100644 index 00000000..2d8e6940 --- /dev/null +++ b/demo/side-by-side-site/index.html @@ -0,0 +1,45 @@ + + + + + + + Side by side - Compose Multiplatform Material demo + + + + + +
+
+

JS DOM / Compose HTML

+ +
+
+

Wasm JS canvas / androidx.compose

+ +
+
+ + + \ No newline at end of file diff --git a/demo/src/jsMain/resources/index.html b/demo/src/jsMain/resources/index.html index 4687f55c..989921be 100644 --- a/demo/src/jsMain/resources/index.html +++ b/demo/src/jsMain/resources/index.html @@ -4,7 +4,7 @@ - Compose Multiplatform Material demo + JS DOM - Compose Multiplatform Material demo