Skip to content

Commit ac70137

Browse files
E
1 parent 9a79438 commit ac70137

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

.github/workflows/obfuscate.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
name: Create Obfuscated Deploy Branch
1+
name: Obfuscate and Push to Main
22

33
on:
44
push:
55
branches:
6-
- main
6+
- dev
77
paths:
88
- '*.html'
99
- '*.js'
1010
- '*.css'
1111

1212
jobs:
13-
create-deploy:
13+
obfuscate-to-main:
1414
runs-on: ubuntu-latest
1515

1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v3
1919
with:
2020
token: ${{ secrets.PAT }}
21+
ref: dev
22+
fetch-depth: 0
2123

2224
- name: Setup Node.js
2325
uses: actions/setup-node@v3
@@ -29,21 +31,9 @@ jobs:
2931
npm install html-minifier-terser --save-dev
3032
npm install javascript-obfuscator --save-dev
3133
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-
4134
- name: Process HTML
4235
run: |
4336
if [ -f "index.html" ]; then
44-
# Backup original
45-
cp index.html index.html.backup
46-
4737
# Process the HTML file
4838
node -e '
4939
const fs = require("fs");
@@ -126,17 +116,14 @@ jobs:
126116
exit 1
127117
fi
128118
129-
- name: Commit to deploy branch
119+
- name: Push to main
130120
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]"
134123
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"
138127
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

Comments
 (0)