This GitHub Action is designed to build a Kotlin Multiplatform (KMP) web application using Gradle. It automates the process of setting up the development environment, caching dependencies, and packaging the web application.
Required: Yes
- Description: Name of the web project module
- Used to specify the correct path for building and uploading the web app artifact
Optional: No
- Description: Java version to use (e.g., 17,21).
- Defaults to 17if not specified.
- Description: Name of the generated artifact
- Value: web-app
flowchart TD
    A[Start Action] --> B[Set up Java Development Environment\nJava 17 with Zulu OpenJDK]
    B --> C[Setup Gradle]
    C --> D[Cache Gradle Dependencies]
    D --> E[Run jsBrowserDistribution\nPackage Web Application]
    E --> F[Upload Web App Artifact]
    F --> G[End Action]
    The action performs the following steps:
- 
Set up Java Development Environment - Uses Zulu distribution of OpenJDK
- Configures Java version 17
 
- 
Setup Gradle - Prepares Gradle for building the project
 
- 
Cache Management - Caches Gradle dependencies, build outputs, and Kotlin/Native artifacts
- Speeds up subsequent builds by reusing cached components
- Caches include:
- Gradle caches
- Gradle wrapper
- Kotlin/Native artifacts
- Build directory
 
 
- 
Package Web Application - Runs ./gradlew jsBrowserDistributionto create the web app distribution
 
- Runs 
- 
Artifact Upload - Uploads the web app artifact from the specified module's build directory
 
name: Build Web App
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: openMF/[email protected]
        with:
          web_package_name: 'web'- GitHub Actions runner with bash support
- Gradle project configured for Kotlin Multiplatform
- Java (configurable; defaults to 17)
- Zulu OpenJDK distribution
- Ensure your Gradle build scripts are configured for JS browser distribution
- Verify that the web_package_namematches your project's module structure
- Use consistent Gradle and Java versions across local and CI environments
- Check Gradle logs if the build fails
- Verify that the jsBrowserDistributiontask is correctly configured in your build script
- Ensure all necessary dependencies are declared in your Gradle files