-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
run: npm install -g pnpm | ||
|
||
- name: Install minification tools locally | ||
run: pnpm add -D html-minifier-terser clean-css-cli terser | ||
run: pnpm add -D html-minifier-terser clean-css-cli terser json-minify | ||
|
||
- name: Fetch all branches | ||
run: git fetch --all | ||
|
@@ -31,11 +31,12 @@ jobs: | |
run: | | ||
git checkout -B minified origin/main | ||
- name: Minify HTML, CSS, and JS | ||
- name: Minify HTML, CSS, JS, and JSON | ||
run: | | ||
find . -name "*.html" -exec npx html-minifier-terser --collapse-whitespace --remove-comments --minify-js true --minify-css true -o {} {} \; | ||
find . -name "*.css" -exec npx cleancss -o {} {} \; | ||
find . -name "*.js" -exec npx terser --compress --mangle --output {} -- {} \; | ||
find . -name "*.json" -exec sh -c 'npx json-minify < "$1" > "$1.tmp" && mv "$1.tmp" "$1"' _ {} \; | ||
- name: Commit and Push Minified Files to Minified Branch | ||
env: | ||
|
@@ -44,5 +45,5 @@ jobs: | |
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
git add -A | ||
git commit -m "Minified HTML, CSS, and JS" | ||
git commit -m "Minified HTML, CSS, JS, and JSON" | ||
git push --force "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/ukrioo/ukrioo.github.io.git" minified |