1
- name : Create Obfuscated Deploy Branch
1
+ name : Obfuscate and Push to Main
2
2
3
3
on :
4
4
push :
5
5
branches :
6
- - main
6
+ - dev
7
7
paths :
8
8
- ' *.html'
9
9
- ' *.js'
10
10
- ' *.css'
11
11
12
12
jobs :
13
- create-deploy :
13
+ obfuscate-to-main :
14
14
runs-on : ubuntu-latest
15
15
16
16
steps :
17
17
- name : Checkout repository
18
18
uses : actions/checkout@v3
19
19
with :
20
20
token : ${{ secrets.PAT }}
21
+ ref : dev
22
+ fetch-depth : 0
21
23
22
24
- name : Setup Node.js
23
25
uses : actions/setup-node@v3
29
31
npm install html-minifier-terser --save-dev
30
32
npm install javascript-obfuscator --save-dev
31
33
32
- - name : Create deploy branch from current state
33
- run : |
34
- # Configure git
35
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
36
- git config --global user.name "github-actions[bot]"
37
-
38
- # Create/checkout deploy branch
39
- git checkout -B deploy
40
-
41
34
- name : Process HTML
42
35
run : |
43
36
if [ -f "index.html" ]; then
44
- # Backup original
45
- cp index.html index.html.backup
46
-
47
37
# Process the HTML file
48
38
node -e '
49
39
const fs = require("fs");
@@ -126,17 +116,14 @@ jobs:
126
116
exit 1
127
117
fi
128
118
129
- - name : Commit to deploy branch
119
+ - name : Push to main
130
120
run : |
131
- git add index.html
132
- git commit -m "Deploy obfuscated version [skip ci]" || echo "No changes to commit"
133
- git push -f origin deploy
121
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
122
+ git config --global user.name "github-actions[bot]"
134
123
135
- - name : Restore original state
136
- run : |
137
- mv index.html.backup index.html
124
+ # Add and commit changes
125
+ git add .
126
+ git commit -m "Deploy obfuscated version from dev [skip ci]" || echo "No changes to commit"
138
127
139
- - name : Clean up
140
- if : always()
141
- run : |
142
- git checkout main
128
+ # Force push to main
129
+ git push -f origin HEAD:main
0 commit comments