48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
name: Prepare for deployment.
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
|
|
jobs:
|
|
minify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: build
|
|
fetch-depth: '3'
|
|
|
|
- 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 branch -D build
|
|
git branch build
|
|
git checkout build
|
|
|
|
- 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
|