Files
portfolio/.github/workflows/minify.yml
MajorDroolz fd3e696013 FIX: minify
2022-12-20 01:58:22 -05:00

46 lines
1.4 KiB
YAML

name: Prepare for deployment.
on:
push:
branches:
- 'main'
jobs:
minify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: build
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies.
run: npm i -g terser csso-cli html-minifier
- name: Copy over changes.
run: |
git reset HEAD^
git pull main
- 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
- name: Create pull request.
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Minified HTML, CSS, JS. Prepared for production.
committer: github-actions <github-actions@users.noreply.github.com>
author: github-actions <github-actions@users.noreply.github.com>
title: Deploy changes from main branch.
body: Automated with [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action.
assignees: MajorDroolz
reviewers: MajorDroolz
branch: temp