@@ -14,19 +14,26 @@ jobs:
14
14
- name : Build
15
15
uses : jerryjvl/jekyll-build-action@v1
16
16
17
- - name : Clean HTML files properly
18
- run : |
19
- find _site -name "*.html" -type f -exec sh -c '
20
- for file; do
21
- # Remove empty lines, whitespace lines, and compress newlines
22
- awk "NF || !p; {p=NF}" "$file" | \
23
- sed "s/^[[:space:]]*$//" | \
24
- awk "!NF{if (++n<=1) print; next}; {n=0; print}" > "$file.tmp" && \
25
- mv "$file.tmp" "$file"
26
- done
27
- ' sh {} +
28
-
29
-
17
+ - name : Clean HTML files
18
+ run : |
19
+ # Ensure we have permissions
20
+ chmod -R u+w _site
21
+
22
+ # Remove empty lines using Python (most reliable)
23
+ python3 -c "
24
+ import os
25
+ import re
26
+ for root, dirs, files in os.walk('_site'):
27
+ for f in files:
28
+ if f.endswith('.html'):
29
+ path = os.path.join(root, f)
30
+ with open(path, 'r') as file:
31
+ content = file.read()
32
+ content = re.sub(r'\n\s*\n', '\n', content)
33
+ content = re.sub(r'^\s*\n', '', content, flags=re.MULTILINE)
34
+ with open(path, 'w') as file:
35
+ file.write(content)
36
+ "
30
37
31
38
- name : Configure AWS credentials
32
39
uses : aws-actions/configure-aws-credentials@v1
0 commit comments