Skip to content

Commit 9a4b615

Browse files
committed
🐛 Fix: failed to build
1 parent af78418 commit 9a4b615

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Deploy to GitHub Pages
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88
workflow_dispatch:
99

1010
permissions:
@@ -88,8 +88,27 @@ jobs:
8888

8989
- name: Optimize Assets
9090
run: |
91-
html-minifier-terser --input-dir dist --output-dir dist --file-ext html --collapse-whitespace --remove-comments
92-
svgo -f dist -r
91+
# HTML Minification
92+
html-minifier-terser \
93+
--input-dir dist \
94+
--output-dir dist \
95+
--file-ext html \
96+
--collapse-whitespace \
97+
--remove-comments \
98+
--remove-redundant-attributes \
99+
--remove-script-type-attributes \
100+
--remove-style-link-type-attributes \
101+
--use-short-doctype \
102+
--minify-css true \
103+
--minify-js true \
104+
|| echo "HTML minification failed, continuing..."
105+
106+
# SVG Optimization (only if SVG files exist)
107+
if find dist -name "*.svg" -type f -print -quit | grep -q .; then
108+
svgo -f dist -r
109+
else
110+
echo "No SVG files found to optimize"
111+
fi
93112
94113
- name: Deploy to GitHub Pages
95114
uses: peaceiris/actions-gh-pages@v3
@@ -117,4 +136,4 @@ jobs:
117136
owner: context.repo.owner,
118137
repo: context.repo.repo,
119138
body: message
120-
});
139+
});

0 commit comments

Comments
 (0)