Skip to content

Commit 62ac6e8

Browse files
LKuemmelbenderl
andauthored
build all themes (#2886)
* build all themes * remove hard coded theme bases --------- Co-authored-by: Lutz Bender <github@lutz-bender.de>
1 parent 1fa3ea2 commit 62ac6e8

5 files changed

Lines changed: 89 additions & 164 deletions

File tree

.github/workflows/build_display_theme_cards.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/build_display_theme_colors.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/build_web_theme_colors.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/build_web_theme_koala.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Publish to master
2+
on:
3+
push:
4+
paths:
5+
- 'packages/modules/*_themes/*/source/**'
6+
branches:
7+
- master
8+
9+
jobs:
10+
build-and-push-themes:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
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+
47+
- name: Setup Node.js v24
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 24
51+
cache: npm
52+
cache-dependency-path: ${{ steps.discover.outputs.cache_paths }}
53+
54+
- name: Install dependencies and build all themes
55+
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"
63+
npm install
64+
npm run build --if-present
65+
cd -
66+
else
67+
echo "Skipping $base - no source directory"
68+
fi
69+
done
70+
71+
- name: Commit and push built themes
72+
run: |
73+
git config user.name "GitHub Actions"
74+
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
82+
if ! git diff --cached --quiet; then
83+
git commit -m "Build Themes"
84+
git push
85+
else
86+
echo "No changes to commit."
87+
fi
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)