From 7f56ec19eac41810afc5e618e24da82be61fda2e Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Fri, 31 Oct 2025 15:06:20 +0100 Subject: [PATCH 1/2] build all themes --- .../workflows/build_display_theme_cards.yml | 41 ------------ .../workflows/build_display_theme_colors.yml | 41 ------------ .github/workflows/build_web_theme_colors.yml | 41 ------------ .github/workflows/build_web_theme_koala.yml | 41 ------------ .github/workflows/publish_to_master.yml | 64 +++++++++++++++++++ 5 files changed, 64 insertions(+), 164 deletions(-) delete mode 100644 .github/workflows/build_display_theme_cards.yml delete mode 100644 .github/workflows/build_display_theme_colors.yml delete mode 100644 .github/workflows/build_web_theme_colors.yml delete mode 100644 .github/workflows/build_web_theme_koala.yml create mode 100644 .github/workflows/publish_to_master.yml diff --git a/.github/workflows/build_display_theme_cards.yml b/.github/workflows/build_display_theme_cards.yml deleted file mode 100644 index 002b0378e8..0000000000 --- a/.github/workflows/build_display_theme_cards.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build Display Theme Cards - -on: - push: - paths: - - packages/modules/display_themes/cards/source/** - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Node.js v24 - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm - cache-dependency-path: packages/modules/display_themes/cards/source/package-lock.json - - - name: Install Dependencies and Build - run: | - cd packages/modules/display_themes/cards/source - npm install - npm run build --if-present - - - name: Commit and Push Changes - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - git add packages/modules/display_themes/cards/web - if ! git diff --cached --quiet; then - git commit -m "Build Display Theme: Cards" - git push - else - echo "No changes to commit." - fi diff --git a/.github/workflows/build_display_theme_colors.yml b/.github/workflows/build_display_theme_colors.yml deleted file mode 100644 index c1853cfdd1..0000000000 --- a/.github/workflows/build_display_theme_colors.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build Display Theme Colors - -on: - push: - paths: - - packages/modules/display_themes/colors/source/** - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Node.js (v22) - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - cache-dependency-path: packages/modules/display_themes/colors/source/package-lock.json - - - name: Install Dependencies and Build - run: | - cd packages/modules/display_themes/colors/source - npm install - npm run build --if-present - - - name: Commit and Push Changes - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - git add packages/modules/display_themes/colors/web - if ! git diff --cached --quiet; then - git commit -m "Build Display Theme: Colors" - git push - else - echo "No changes to commit." - fi diff --git a/.github/workflows/build_web_theme_colors.yml b/.github/workflows/build_web_theme_colors.yml deleted file mode 100644 index f0205e2e92..0000000000 --- a/.github/workflows/build_web_theme_colors.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build Web Theme Colors - -on: - push: - paths: - - packages/modules/web_themes/colors/source/** - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Node.js 24 - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm - cache-dependency-path: packages/modules/web_themes/colors/source/package-lock.json - - - name: Install Dependencies and Build - run: | - cd packages/modules/web_themes/colors/source - npm install - npm run build --if-present - - - name: Commit and Push Changes - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - git add packages/modules/web_themes/colors/web - if ! git diff --cached --quiet; then - git commit -m "Build Web Theme: Colors" - git push - else - echo "No changes to commit." - fi diff --git a/.github/workflows/build_web_theme_koala.yml b/.github/workflows/build_web_theme_koala.yml deleted file mode 100644 index af99325902..0000000000 --- a/.github/workflows/build_web_theme_koala.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build Web Theme Koala - -on: - push: - paths: - - packages/modules/web_themes/koala/source/** - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Node.js 24 - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm - cache-dependency-path: packages/modules/web_themes/koala/source/package-lock.json - - - name: Install Dependencies and Build - run: | - cd packages/modules/web_themes/koala/source - npm install - npm run build --if-present - - - name: Commit and Push Changes - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - git add packages/modules/web_themes/koala/web - if ! git diff --cached --quiet; then - git commit -m "Build Web Theme: Koala" - git push - else - echo "No changes to commit." - fi diff --git a/.github/workflows/publish_to_master.yml b/.github/workflows/publish_to_master.yml new file mode 100644 index 0000000000..b2a3184563 --- /dev/null +++ b/.github/workflows/publish_to_master.yml @@ -0,0 +1,64 @@ + + + +name: Publish to master +on: + push: + paths: + - packages/modules/display_themes/cards/source/** + - packages/modules/display_themes/colors/source/** + - packages/modules/web_themes/colors/source/** + - packages/modules/web_themes/koala/source/** + + +jobs: + build-and-push-themes: + runs-on: ubuntu-latest + env: + THEME_BASES: | + packages/modules/display_themes/cards/source + packages/modules/display_themes/colors/source + packages/modules/web_themes/colors/source + packages/modules/web_themes/koala/source + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Node.js 24 + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + cache-dependency-path: | + packages/modules/display_themes/cards/source/package-lock.json + packages/modules/display_themes/colors/source/package-lock.json + packages/modules/web_themes/colors/source/package-lock.json + packages/modules/web_themes/koala/source/package-lock.json + + - name: Installiere Abhängigkeiten und baue alle Themes + run: | + for base in $THEME_BASES; do + echo "Installiere und baue Theme: $base" + cd "$base" + npm ci || npm install + npm run build + cd - + done + + - name: Commit und Push gebaute Themes + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add packages/modules/web_themes/koala/web + git add packages/modules/web_themes/colors/web + git add packages/modules/display_themes/cards/web + git add packages/modules/display_themes/colors/web + if ! git diff --cached --quiet; then + git commit -m "Build Web Themes" + git push + else + echo "No changes to commit." + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From 521521ae06828a7bcd24a57c30773488a93d27d4 Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Tue, 4 Nov 2025 10:14:58 +0100 Subject: [PATCH 2/2] remove hard coded theme bases --- .github/workflows/publish_to_master.yml | 93 ++++++++++++++++--------- 1 file changed, 59 insertions(+), 34 deletions(-) diff --git a/.github/workflows/publish_to_master.yml b/.github/workflows/publish_to_master.yml index b2a3184563..d03265d057 100644 --- a/.github/workflows/publish_to_master.yml +++ b/.github/workflows/publish_to_master.yml @@ -1,64 +1,89 @@ - - - name: Publish to master on: push: paths: - - packages/modules/display_themes/cards/source/** - - packages/modules/display_themes/colors/source/** - - packages/modules/web_themes/colors/source/** - - packages/modules/web_themes/koala/source/** - + - 'packages/modules/*_themes/*/source/**' + branches: + - master jobs: build-and-push-themes: runs-on: ubuntu-latest - env: - THEME_BASES: | - packages/modules/display_themes/cards/source - packages/modules/display_themes/colors/source - packages/modules/web_themes/colors/source - packages/modules/web_themes/koala/source steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Set up Node.js 24 + - 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<> $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<> $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: | - packages/modules/display_themes/cards/source/package-lock.json - packages/modules/display_themes/colors/source/package-lock.json - packages/modules/web_themes/colors/source/package-lock.json - packages/modules/web_themes/koala/source/package-lock.json + cache-dependency-path: ${{ steps.discover.outputs.cache_paths }} - - name: Installiere Abhängigkeiten und baue alle Themes + - name: Install dependencies and build all themes run: | - for base in $THEME_BASES; do - echo "Installiere und baue Theme: $base" - cd "$base" - npm ci || npm install - npm run build - cd - + 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" + npm install + npm run build --if-present + cd - + else + echo "Skipping $base - no source directory" + fi done - - name: Commit und Push gebaute Themes + - name: Commit and push built themes run: | git config user.name "GitHub Actions" git config user.email "actions@github.com" - git add packages/modules/web_themes/koala/web - git add packages/modules/web_themes/colors/web - git add packages/modules/display_themes/cards/web - git add packages/modules/display_themes/colors/web + 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 if ! git diff --cached --quiet; then - git commit -m "Build Web Themes" + git commit -m "Build Themes" git push else echo "No changes to commit." fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -