Skip to content

Commit e6089f0

Browse files
committed
html
Signed-off-by: Leonid Petrov <lenia.petrov@gmail.com>
1 parent 3078399 commit e6089f0

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.github/workflows/github-actions-s3-publish.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,26 @@ jobs:
1414
- name: Build
1515
uses: jerryjvl/jekyll-build-action@v1
1616

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+
"
3037
3138
- name: Configure AWS credentials
3239
uses: aws-actions/configure-aws-credentials@v1

0 commit comments

Comments
 (0)