Skip to content

Merge pull request #1434 from elax46/dev #146

Merge pull request #1434 from elax46/dev

Merge pull request #1434 from elax46/dev #146

name: Build Custom Brand Icons
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 1️⃣ Checkout repository
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: true
# 2️⃣ Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 22
# 3️⃣ Install dependencies
# Use "clean install" to rely upon package-lock.json
- name: Install dependencies
run: npm ci
# 4️⃣ Install ImageMagick (necessario per npm run clean:vrt)
- name: Install ImageMagick
run: sudo apt-get update && sudo apt-get install -y imagemagick
# 5️⃣ Clean / normalize icons + VRT
- name: Clean / normalize icons
run: |
set -e
echo "🧹 Running npm run clean:vrt..."
npm run clean:vrt
echo "✅ Normalization completed"
echo "📂 icon-svg content:"
ls -la icon-svg
echo "📂 script content:"
ls -la script
# 6️⃣ Build JS bundle
- name: Build icons
run: |
set -e
if [ ! -f custom-icons-builder.cjs ]; then
echo "❌ custom-icons-builder.cjs not found!"
exit 1
fi
echo "🚀 Running builder..."
node custom-icons-builder.cjs
if [ ! -f dist/custom-brand-icons.js ]; then
echo "❌ Build failed: dist/custom-brand-icons.js not generated"
exit 1
fi
echo "✅ Build completed successfully"
echo "📂 dist content:"
ls -la dist
# 7️⃣ Commit dist and normalized SVGs (solo se ci sono modifiche)
- name: Commit dist & icon-svg changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Forza l'add anche dei file normalmente ignorati
git add -f dist icon-svg
if git diff --staged --quiet; then
echo "ℹ️ No changes in dist or icon-svg"
exit 0
fi
git commit -m "chore: update dist & normalized SVGs [ci skip]"
git push origin HEAD:main
# 8️⃣ Upload dist artifact
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: custom-brand-icons-dist
path: dist