Refactor HTML Empty Line Removal Step #2365
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy Jekyll site | |
on: [push] | |
jobs: | |
jekyll: | |
name: Build and deploy Jekyll site | |
runs-on: ubuntu-latest | |
environment: main | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build | |
uses: jerryjvl/jekyll-build-action@v1 | |
- name: Remove empty lines from HTML files | |
run: | | |
echo "Removing empty lines from HTML files..." | |
count=0 | |
find _site -name "*.html" -type f | while IFS= read -r file; do | |
# Create temp file with cleaned content | |
grep -v '^[[:space:]]*$' "$file" > "${file}.cleaned" || true | |
# Replace original if cleaning succeeded | |
if [ -s "${file}.cleaned" ]; then | |
mv "${file}.cleaned" "$file" | |
((count++)) || true | |
else | |
rm -f "${file}.cleaned" | |
fi | |
done | |
echo "✅ Processed HTML files" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
# - name: Check HTML | |
# uses: chabad360/htmlproofer@master | |
# with: | |
# # The directory to scan | |
# directory: "./_site" | |
# # The arguments to pass to HTMLProofer | |
# arguments: --disable-external true --allow-hash-href true --file-ignore "/_site/old.math.virginia.edu/" | |
- name: Sync output to S3 | |
run: | | |
aws s3 sync ./_site/ s3://math.virginia.edu --delete |