Skip to content

Commit d51edcd

Browse files
committed
fix build themes wotkflow (openWB#2903)
1 parent e7483f6 commit d51edcd

1 file changed

Lines changed: 10 additions & 49 deletions

File tree

.github/workflows/publish_to_master.yml

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,72 +13,33 @@ jobs:
1313
- name: Checkout Repository
1414
uses: actions/checkout@v4
1515

16-
- name: Discover theme bases
17-
id: discover
18-
run: |
19-
# Find directories matching packages/modules/*_themes/* that contain a source/ subdir
20-
mapfile -d $'\0' found < <(find packages/modules -type d -path 'packages/modules/*_themes/*' -print0)
21-
theme_bases=()
22-
for d in "${found[@]}"; do
23-
# trim trailing NUL if any
24-
d="${d%$'\0'}"
25-
if [ -d "$d/source" ]; then
26-
theme_bases+=("$d")
27-
fi
28-
done
29-
30-
# Prepare newline-separated THEME_BASES output
31-
echo "theme_bases<<EOF" >> $GITHUB_OUTPUT
32-
for b in "${theme_bases[@]}"; do
33-
printf "%s\n" "$b"
34-
done >> $GITHUB_OUTPUT
35-
echo "EOF" >> $GITHUB_OUTPUT
36-
37-
# Prepare newline-separated cache paths (package-lock.json)
38-
cache_paths=""
39-
for b in "${theme_bases[@]}"; do
40-
cache_paths="${cache_paths}${b}/source/package-lock.json\n"
41-
done
42-
cache_paths=${cache_paths%\\n}
43-
echo "cache_paths<<EOF" >> $GITHUB_OUTPUT
44-
printf "%b" "$cache_paths" >> $GITHUB_OUTPUT
45-
echo "EOF" >> $GITHUB_OUTPUT
46-
4716
- name: Setup Node.js v24
4817
uses: actions/setup-node@v4
4918
with:
5019
node-version: 24
5120
cache: npm
52-
cache-dependency-path: ${{ steps.discover.outputs.cache_paths }}
21+
cache-dependency-path: 'packages/modules/*_themes/*/source/package-lock.json'
5322

5423
- name: Install dependencies and build all themes
5524
run: |
56-
theme_bases_str="${{ steps.discover.outputs.theme_bases }}"
57-
# read into array splitting on newline
58-
IFS=$'\n' read -r -d '' -a THEME_BASES <<< "$theme_bases_str"$'\0' || true
59-
for base in "${THEME_BASES[@]}"; do
60-
echo "Install and build Theme: $base"
61-
if [ -d "$base/source" ]; then
62-
cd "$base/source"
25+
for theme_dir in packages/modules/*_themes/*/; do
26+
if [ -d "$theme_dir/source" ]; then
27+
echo "Building theme: $theme_dir"
28+
cd "$theme_dir/source"
6329
npm install
6430
npm run build --if-present
65-
cd -
66-
else
67-
echo "Skipping $base - no source directory"
31+
cd - > /dev/null
6832
fi
6933
done
7034
7135
- name: Commit and push built themes
7236
run: |
7337
git config user.name "GitHub Actions"
7438
git config user.email "actions@github.com"
75-
theme_bases_str="${{ steps.discover.outputs.theme_bases }}"
76-
IFS=$'\n' read -r -d '' -a THEME_BASES <<< "$theme_bases_str"$'\0' || true
77-
for base in "${THEME_BASES[@]}"; do
78-
if [ -d "$base/web" ]; then
79-
git add "$base/web"
80-
fi
81-
done
39+
40+
# Add all built theme files
41+
git add packages/modules/*_themes/*/web/
42+
8243
if ! git diff --cached --quiet; then
8344
git commit -m "Build Themes"
8445
git push

0 commit comments

Comments
 (0)