Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 10 additions & 49 deletions .github/workflows/publish_to_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,72 +13,33 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Discover theme bases
id: discover
run: |
# Find directories matching packages/modules/*_themes/* that contain a source/ subdir
mapfile -d $'\0' found < <(find packages/modules -type d -path 'packages/modules/*_themes/*' -print0)
theme_bases=()
for d in "${found[@]}"; do
# trim trailing NUL if any
d="${d%$'\0'}"
if [ -d "$d/source" ]; then
theme_bases+=("$d")
fi
done

# Prepare newline-separated THEME_BASES output
echo "theme_bases<<EOF" >> $GITHUB_OUTPUT
for b in "${theme_bases[@]}"; do
printf "%s\n" "$b"
done >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Prepare newline-separated cache paths (package-lock.json)
cache_paths=""
for b in "${theme_bases[@]}"; do
cache_paths="${cache_paths}${b}/source/package-lock.json\n"
done
cache_paths=${cache_paths%\\n}
echo "cache_paths<<EOF" >> $GITHUB_OUTPUT
printf "%b" "$cache_paths" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Setup Node.js v24
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: ${{ steps.discover.outputs.cache_paths }}
cache-dependency-path: 'packages/modules/*_themes/*/source/package-lock.json'

- name: Install dependencies and build all themes
run: |
theme_bases_str="${{ steps.discover.outputs.theme_bases }}"
# read into array splitting on newline
IFS=$'\n' read -r -d '' -a THEME_BASES <<< "$theme_bases_str"$'\0' || true
for base in "${THEME_BASES[@]}"; do
echo "Install and build Theme: $base"
if [ -d "$base/source" ]; then
cd "$base/source"
for theme_dir in packages/modules/*_themes/*/; do
if [ -d "$theme_dir/source" ]; then
echo "Building theme: $theme_dir"
cd "$theme_dir/source"
npm install
npm run build --if-present
cd -
else
echo "Skipping $base - no source directory"
cd - > /dev/null
fi
done

- name: Commit and push built themes
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
theme_bases_str="${{ steps.discover.outputs.theme_bases }}"
IFS=$'\n' read -r -d '' -a THEME_BASES <<< "$theme_bases_str"$'\0' || true
for base in "${THEME_BASES[@]}"; do
if [ -d "$base/web" ]; then
git add "$base/web"
fi
done

# Add all built theme files
git add packages/modules/*_themes/*/web/

if ! git diff --cached --quiet; then
git commit -m "Build Themes"
git push
Expand Down