FEAT: Cleaned up Prepare GitHub action
This commit is contained in:
32
.github/workflows/minify.yml
vendored
32
.github/workflows/minify.yml
vendored
@@ -1,5 +1,4 @@
|
|||||||
# A Github Action that minifies html/css/js and pushes it to a new branch
|
name: Prepare for deployment.
|
||||||
name: minify
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -11,24 +10,27 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
# Install CLI tools
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: '16'
|
||||||
- run: npm i -g terser csso-cli html-minifier
|
|
||||||
|
|
||||||
# Use CLI tools to minify, overwriting existing files
|
- name: Install dependencies.
|
||||||
- run: for i in `find . -name "*.js" -type f`; do terser $i --compress -o $i; done
|
run: npm i -g terser csso-cli html-minifier
|
||||||
- run: for i in `find . -name "*.css" -type f`; do csso $i -o $i; done
|
|
||||||
- run: for i in `find . -name "*.html" -type f`; do html-minifier --remove-comments --collapse-whitespace $i -o $i; done
|
- 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
|
||||||
|
|
||||||
# Push changes to `build` branch
|
- name: Create pull request.
|
||||||
- name: Create report file
|
|
||||||
run: date +%s > report.txt
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
|
commit-message: Minified HTML, CSS, JS. Prepared for production.
|
||||||
|
committer: github-actions
|
||||||
|
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
|
||||||
base: build
|
base: build
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user