-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (39 loc) · 1.38 KB
/
deploy.yml
File metadata and controls
48 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Build, Deploy, and Obfuscate
on:
push:
branches:
- main # Trigger the workflow on pushes to the main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Minification and Obfuscation Tools
run: |
npm install -g terser clean-css-cli html-minifier-terser javascript-obfuscator
- name: Minify and Obfuscate JavaScript
run: |
for file in $(find ./assets/js -type f -name "*.js"); do
javascript-obfuscator "$file" --output "$file"
done
- name: Minify CSS
run: |
for file in $(find ./assets/css -type f -name "*.css"); do
cleancss -o "$file" "$file"
done
- name: Minify HTML
run: |
for file in $(find . -type f -name "*.html"); do
html-minifier-terser --collapse-whitespace --remove-comments --minify-css true --minify-js true -o "$file" "$file"
done
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: deployment
folder: . # Deploy files from the root of the repository
clean: true # Ensures the gh-pages branch is cleaned before deploying