@@ -27,13 +27,43 @@ jobs:
2727 distribution : temurin
2828 java-version : " 22"
2929
30- - name : Grant execute permission for gradlew
31- run : chmod +x ./gradlew
30+ - name : Make gradlew executable (if present)
31+ run : |
32+ if [ -f "./gradlew" ]; then
33+ chmod +x ./gradlew
34+ fi
3235
33- # Generic KMP build for all JS browser targets
34- - name : Build all JS browser distributions
36+ - name : Build all web apps (per subproject)
3537 run : |
36- ./gradlew jsBrowserDistribution --continue
38+ set -e
39+
40+ # Optional: ensure jq exists (Ubuntu images usually have it already)
41+ if ! command -v jq >/dev/null 2>&1; then
42+ sudo apt-get update
43+ sudo apt-get install -y jq
44+ fi
45+
46+ # Find all webapp.json files
47+ while IFS= read -r meta; do
48+ app_dir="$(dirname "$meta")"
49+
50+ build_cmd="$(jq -r '.build.command // empty' "$meta")"
51+
52+ if [ -z "$build_cmd" ]; then
53+ echo "[INFO] $meta has no build.command, skipping build step."
54+ continue
55+ fi
56+
57+ echo "[INFO] Building app in $app_dir with: $build_cmd"
58+
59+ (
60+ cd "$app_dir"
61+ # Execute the command as defined in webapp.json
62+ set -e
63+ eval "$build_cmd"
64+ )
65+
66+ done < <(find . -name webapp.json -print)
3767
3868 - name : Prepare static site folder (scan apps & generate index)
3969 run : |
@@ -71,12 +101,11 @@ jobs:
71101 description = meta.get("description", "")
72102 screenshot_rel = meta.get("screenshot")
73103
74- # NEW: allow distDirs list, fallback to single distDir string for compatibility
104+ # Allow distDirs list, fallback to single distDir
75105 dist_dirs_rel = []
76-
77- if "distDirs" in meta and isinstance(meta["distDirs"], list):
106+ if isinstance(meta.get("distDirs"), list):
78107 dist_dirs_rel = meta["distDirs"]
79- elif "distDir" in meta and isinstance(meta[ "distDir"] , str):
108+ elif isinstance(meta.get( "distDir") , str):
80109 dist_dirs_rel = [meta["distDir"]]
81110
82111 if not app_id:
89118
90119 project_root = dirpath
91120
92- # Choose the first distDir that contains index.html
121+ # Choose first distDir that contains index.html
93122 chosen_dist_dir = None
94123 for rel in dist_dirs_rel:
95124 cand_dist = os.path.join(project_root, rel)
99128 break
100129
101130 if not chosen_dist_dir:
102- print(f"[INFO] No index.html found in any distDir for app {app_id}, skipping.")
131+ print(f"[INFO] No index.html in any distDir for {app_id}, skipping.")
103132 continue
104133
105134 print(f"[OK] Using dist dir {chosen_dist_dir} for app {app_id}")
0 commit comments