Files
portfolio/.github/workflows/minify.yml
Workflow config file is invalid. Please check your config file: yaml: line 20: could not find expected ':'
2022-12-19 14:54:07 -05:00

34 lines
994 B
YAML

# A Github Action that minifies html/css/js and pushes it to a new branch
name: minify
on:
push:
branches:
- 'main'
jobs:
minify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install CLI tools
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: |
npm install -g terser csso-cli html-minifier
# Use CLI tools to minify, overwriting existing files
- run: |
for i in `find . -name "*.js" -type f`; terser $i --compress -o $i; done
for i in `find . -name "*.css" -type f`; do csso $i -o $i; done
for i in `find . -name "*.html" -type f`; do html-minifier $i -o $i; done
# Push changes to `build` branch
- run: |
git config user.name MajorDroolz
git config user.email MajorDroolz@user.noreply.github.com
git commit -am 'Automated minify of ${{ github.sha }}'
git push --force -u origin main:build