Skip to content

Commit

Permalink
Use local minify action
Browse files Browse the repository at this point in the history
Waiting for the following PR to be approved:
anthonyftwang/minify-action#8
  • Loading branch information
coliveiraeti committed Dec 19, 2023
1 parent 14054a3 commit 8651714
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/actions/minify/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:19-bullseye-slim

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
9 changes: 9 additions & 0 deletions .github/actions/minify/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'Minify Action'
description: 'Minify js, css, and html files pushed to a branch'
runs:
using: 'docker'
image: 'Dockerfile'

branding:
icon: "minimize-2"
color: "red"
10 changes: 10 additions & 0 deletions .github/actions/minify/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh -l

npm i minify@11.0.1 -g
apt-get update
apt-get -y install moreutils

find . -type f \( -iname \*.html -o -iname \*.js -o -iname \*.css \) | while read fname
do
minify ${fname} | sponge ${fname}
done
4 changes: 4 additions & 0 deletions .github/workflows/azure-staticwebapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true

- name: Minify
uses: ./.github/actions/minify

- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
Expand Down

0 comments on commit 8651714

Please sign in to comment.