Skip to content

Improve HTML Cleaning Step in github-actions-s3-publish.yml #2366

Improve HTML Cleaning Step in github-actions-s3-publish.yml

Improve HTML Cleaning Step in github-actions-s3-publish.yml #2366

name: Build and deploy Jekyll site
on: [push]
jobs:
jekyll:

Check failure on line 5 in .github/workflows/github-actions-s3-publish.yml

View workflow run for this annotation

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

Invalid workflow file

You have an error in your yaml syntax on line 5
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 properly
run: |
find _site -name "*.html" -type f -exec sh -c '
for file; do
# Remove empty lines, whitespace lines, and compress newlines
awk "NF || !p; {p=NF}" "$file" | \
sed "s/^[[:space:]]*$//" | \
awk "!NF{if (++n<=1) print; next}; {n=0; print}" > "$file.tmp" && \
mv "$file.tmp" "$file"
done
' sh {} +
- 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