Skip to content

html

html #2367

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: Clean HTML files
run: |
# Ensure we have permissions
chmod -R u+w _site
# Remove empty lines using Python (most reliable)
python3 -c "
import os
import re
for root, dirs, files in os.walk('_site'):
for f in files:
if f.endswith('.html'):
path = os.path.join(root, f)
with open(path, 'r') as file:
content = file.read()
content = re.sub(r'\n\s*\n', '\n', content)
content = re.sub(r'^\s*\n', '', content, flags=re.MULTILINE)
with open(path, 'w') as file:
file.write(content)
"
- 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