Files
portfolio/.github/workflows/minify.yml
2022-12-20 03:25:30 -05:00

39 lines
1.1 KiB
YAML

name: Prepare for deployment.
on:
push:
branches:
- 'main'
jobs:
minify:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies.
run: npm i -g terser csso-cli html-minifier
- run: |
git branch temp
git checkout temp
- name: Minify files.
run: |
for i in `find . -name "*.js" -type f`; do 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 --remove-comments --collapse-whitespace $i -o $i; done
- run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git commit -am "STUFF"
- run: |
git push -f --set-upstream origin temp
- run: gh pr create --title "Pull request title" --body "Pull request body" --base "build"