Skip to content

Commit 5a29e90

Browse files
authored
[🔀 Merge] PR #45 into HugoAura:dev
## [✨ Feat] Add ASAR patch locally (main-project) (#45) * [CI/CD] Delete the patchment of the ASAR on workflow & Change the ZIP packing dir to the whole「src」 * [🔄 Chore / 🛠️ Fix] Rename the workflow name & Fixed the path errors * [🛠️ Fix] Fixed the path error of「aura.zip」 * [🔄Chore] Separate aura.zip and core.zip * [🛠️Fix] Fixed the path of zip files.
1 parent 2b9d1c9 commit 5a29e90

1 file changed

Lines changed: 13 additions & 104 deletions

File tree

.github/workflows/pack.yml

Lines changed: 13 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Patch ASAR & Pack source code
1+
name: Pack source code & Create CI/CD Release
22

33
on:
44
schedule:
@@ -13,115 +13,24 @@ permissions: write-all
1313

1414
jobs:
1515
pack:
16-
name: Patch & Pack
16+
name: Pack
1717

1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- name: Setup Node.JS 20 LTS
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version: "20"
25-
26-
- name: Install dependencies
27-
run: |
28-
sudo apt update
29-
sudo apt install -y p7zip-full wget
30-
npm install -g asar
31-
3221
- name: Checkout repository code
3322
uses: actions/checkout@v4
3423
with:
3524
path: "./HugoAura-Code"
3625

37-
- name: Download SeewoServiceSetup
38-
run: |
39-
echo "[DEBUG] Working DIR:"
40-
pwd
41-
42-
wget -nv -O "SeewoService.exe" "https://e.seewo.com/download/file?code=SeewoServiceSetup"
43-
echo "[DEBUG] Listing downloaded file"
44-
ls -la SeewoService*
45-
46-
- name: Extract SeewoServiceSetup as zip
47-
run: |
48-
mkdir -p SeewoServiceSource
49-
7z x "SeewoService.exe" -o"./SeewoServiceSource/" -y
50-
51-
echo "[DEBUG] Listing extracted files"
52-
ls -la SeewoServiceSource/
53-
54-
- name: Extract ASAR file
55-
run: |
56-
cd SeewoServiceSource
57-
SEEWO_DIR=$(find . -name "SeewoService_*" -type d | head -1)
58-
echo "[INFO] Found SeewoService directory: $SEEWO_DIR"
59-
60-
cd "$SEEWO_DIR/SeewoServiceAssistant/resources/"
61-
62-
asar extract ./app.asar ./app-unpacked
63-
64-
- name: Move app-unpacked and clean SSASource
65-
run: |
66-
mkdir -p SSARes
67-
68-
cd SeewoServiceSource
69-
SEEWO_DIR=$(find . -name "SeewoService_*" -type d | head -1)
70-
mv "$SEEWO_DIR/SeewoServiceAssistant/resources/app-unpacked" "../SSARes/"
71-
72-
cd ..
73-
rm -rf SeewoServiceSource
74-
rm -rf *.exe
75-
echo "[DEBUG] Listing Working DIR"
76-
ls -la
77-
78-
- name: Patch main.js
79-
run: |
80-
cd SSARes/app-unpacked
81-
82-
### cp main.js main.js.bak
83-
84-
cat > patch_main.js << 'EOF'
85-
const fs = require('fs');
86-
87-
let content = fs.readFileSync('main.js', 'utf8');
88-
89-
content = 'const hook = require("./hook.js");\n' + content;
90-
91-
content = content.replace(/n\.m=e/, ';const zeron = require("./zeron.js");n = zeron(n);n.m=e');
92-
93-
content = content.replace(/let f=new s\(Object\.assign\(\{\},\{transparent:!0,/, ';hook({ central: n, windowName: this.wname, config: c });let f=new s(Object.assign({},{transparent:!0,');
94-
95-
content = content.replace(/c\.canOpenDevTool/, 'c.canOpenDevTool,preload: __dirname + "\\\\preload.js"');
96-
97-
fs.writeFileSync('main.js', content);
98-
99-
console.log('[SUCCESS] main.js has been modified successfully');
100-
EOF
101-
102-
echo "[DEBUG] Running patch_main.js"
103-
node ./patch_main.js
104-
105-
rm -rf patch_main.js
106-
107-
- name: Copy HugoAura core files
108-
run: |
109-
cp -r HugoAura-Code/src/core/* SSARes/app-unpacked/
110-
111-
echo "[DEBUG] Listing files under <Working DIR>/SSARes/app-unpacked/"
112-
ls -la SSARes/app-unpacked/
113-
114-
- name: Create artifacts DIR and re-pack ASAR
26+
- name: Create aura.zip
11527
run: |
11628
echo "[DEBUG] Creating artifacts directory"
11729
mkdir -p Artifacts
118-
119-
asar pack SSARes/app-unpacked Artifacts/app-patched.asar
120-
121-
- name: Create aura.zip
122-
run: |
123-
cd HugoAura-Code/src/aura
30+
cd ./HugoAura-Code/src/aura
12431
zip -r ../../../Artifacts/aura.zip .
32+
cd ../core
33+
zip -r ../../../Artifacts/core.zip .
12534
cd ../../..
12635
12736
echo "[DEBUG] Files in <Working DIR>/Artifacts directory:"
@@ -154,18 +63,18 @@ jobs:
15463
#### 🕘 构建时间: ${{ env.BUILDTIME }}
15564
EOF
15665
157-
- name: Upload patched ASAR
158-
uses: actions/upload-artifact@v4
159-
with:
160-
name: asar-patched
161-
path: Artifacts/app-patched.asar
162-
16366
- name: Upload aura.zip
16467
uses: actions/upload-artifact@v4
16568
with:
16669
name: aura-code
16770
path: Artifacts/aura.zip
16871

72+
- name: Upload core.zip
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: aura-core
76+
path: Artifacts/core.zip
77+
16978
- name: Upload release
17079
uses: softprops/action-gh-release@v2
17180
with:
@@ -176,5 +85,5 @@ jobs:
17685
generate_release_notes: false
17786
token: ${{ secrets.GITHUB_TOKEN }}
17887
files: |
179-
Artifacts/app-patched.asar
18088
Artifacts/aura.zip
89+
Artifacts/core.zip

0 commit comments

Comments
 (0)