Guilherme Delgado
04/18/2024, 1:58 PM./gradlew wasmJsBrowserProductionWebpack
? I’ve found a youtube video from @Abdul Basit but I guess is a bit outdated regarding which folders/files to copy from. I’ve a sample running but I’ve found out in the recent compose multiplatform releases things have changed a bit.Tanish Azad
04/18/2024, 2:04 PMwasmJsBrowserDistribution
, and the build should be in ./composeApp/build/dist/wasmJs/productionExecutable
Guilherme Delgado
04/18/2024, 2:07 PM…WebPack
I had to do it by handbashor
04/21/2024, 10:00 PMChris Athanas
04/22/2024, 2:53 AM// Publish to GitHub Pages
// Task to copy from ./composeApp/build/dist/wasmJs/productionExecutable to ./docs
tasks.register("copyWasmJsToDocs") {
group = "build"
doLast {
val wasmJsDir = project.file("./build/dist/wasmJs/productionExecutable")
val docsDir = file(rootDir.path + "/docs")
wasmJsDir.copyRecursively(docsDir, overwrite = true)
}
}
tasks.getByName("wasmJsBrowserDistribution").finalizedBy("copyWasmJsToDocs")
// Task to clean ./docs (docs is the dir that will be published to GitHub Pages)
tasks.register("cleanDocs") {
group = "build"
doLast {
val docsDir = file(rootDir.path + "/docs")
docsDir.deleteRecursively()
}
}
tasks.getByName("clean").dependsOn("cleanDocs")
Run the ./gradlew copyWasmJsToDocs
task, and then push your changes to github. This assumes you have github pages setup to publish: https://kotlinlang.org/docs/wasm-get-started.html#publish-on-github-pagesAbdul Basit
04/22/2024, 3:26 AMTanish Azad
04/22/2024, 9:03 AMname: Compile and push the compiled files only to the compiled branch
on:
push:
branches:
- main
jobs:
build:
name: Compile and Push
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# See: <https://github.com/gradle/actions/blob/main/setup-gradle/README.md>
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
with:
gradle-version: 8.6
- name: Build the production site
run: ./gradlew wasmJsBrowserDistribution
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: ${{ vars.USER_NAME }}
user_email: <${{ vars.USER_EMAIL }}>
publish_dir: ./composeApp/build/dist/wasmJs/productionExecutable