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..d03265d057 --- /dev/null +++ b/.github/workflows/publish_to_master.yml @@ -0,0 +1,89 @@ +name: Publish to master +on: + push: + paths: + - 'packages/modules/*_themes/*/source/**' + branches: + - master + +jobs: + build-and-push-themes: + runs-on: ubuntu-latest + steps: + - 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<> $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: ${{ steps.discover.outputs.cache_paths }} + + - 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" + npm install + npm run build --if-present + cd - + else + echo "Skipping $base - no source directory" + 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 + if ! git diff --cached --quiet; then + git commit -m "Build Themes" + git push + else + echo "No changes to commit." + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}