Skip to content

Commit e92536d

Browse files
author
User
committed
feat: 添加自定义安装程序
- 与主程序风格一致的深色主题 UI - 自定义安装路径 - 创建桌面/开始菜单快捷方式 - 自动启动选项 - 注册卸载程序 - 安装进度显示
1 parent 5a3c84e commit e92536d

10 files changed

Lines changed: 912 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
uses: actions/setup-node@v4
4141
with:
4242
node-version: '20'
43-
cache: 'npm'
4443

4544
- name: Setup Python
4645
uses: actions/setup-python@v5
@@ -59,39 +58,72 @@ jobs:
5958
- name: Install Python dependencies
6059
run: pip install -r requirements.txt pyinstaller
6160

62-
- name: Install Node dependencies
61+
- name: Install main app Node dependencies
6362
run: npm ci
6463

6564
- name: Build backend
6665
run: python build_backend.py
6766

68-
- name: Build Tauri app
67+
- name: Build main Tauri app
6968
run: npm run tauri build
7069

71-
- name: Create portable ZIP
70+
- name: Prepare installer payload
7271
run: |
7372
$version = "v${{ github.run_number }}"
74-
$bundlePath = "src-tauri/target/release"
75-
$zipName = "LoArchive-${version}-portable.zip"
7673
77-
# 创建临时目录
78-
New-Item -ItemType Directory -Force -Path "portable/LoArchive"
74+
# 创建 payload 目录
75+
New-Item -ItemType Directory -Force -Path "installer/src-tauri/payload"
7976
8077
# 复制主程序
81-
Copy-Item "$bundlePath/lofter-spider.exe" "portable/LoArchive/LoArchive.exe"
78+
Copy-Item "src-tauri/target/release/lofter-spider.exe" "installer/src-tauri/payload/LoArchive.exe"
8279
8380
# 复制后端
84-
Copy-Item "src-tauri/binaries/loarchive-backend-x86_64-pc-windows-msvc.exe" "portable/LoArchive/"
81+
Copy-Item "src-tauri/binaries/loarchive-backend-x86_64-pc-windows-msvc.exe" "installer/src-tauri/payload/"
8582
86-
# 复制资源
87-
Copy-Item -Recurse "src-tauri/target/release/resources" "portable/LoArchive/" -ErrorAction SilentlyContinue
83+
# 复制 WebView2 加载器(如果存在)
84+
if (Test-Path "src-tauri/target/release/WebView2Loader.dll") {
85+
Copy-Item "src-tauri/target/release/WebView2Loader.dll" "installer/src-tauri/payload/"
86+
}
87+
88+
Write-Host "Payload prepared successfully"
89+
Get-ChildItem "installer/src-tauri/payload" -Recurse
90+
shell: pwsh
91+
92+
- name: Install installer Node dependencies
93+
run: |
94+
cd installer
95+
npm install
96+
shell: pwsh
97+
98+
- name: Build custom installer
99+
run: |
100+
cd installer
101+
npm run tauri build
102+
shell: pwsh
103+
104+
- name: Create portable ZIP
105+
run: |
106+
$version = "v${{ github.run_number }}"
107+
$zipName = "LoArchive-${version}-portable.zip"
108+
109+
New-Item -ItemType Directory -Force -Path "portable/LoArchive"
110+
Copy-Item "src-tauri/target/release/lofter-spider.exe" "portable/LoArchive/LoArchive.exe"
111+
Copy-Item "src-tauri/binaries/loarchive-backend-x86_64-pc-windows-msvc.exe" "portable/LoArchive/"
88112
89-
# 创建 ZIP
90113
Compress-Archive -Path "portable/LoArchive" -DestinationPath $zipName -Force
91114
92115
echo "PORTABLE_ZIP=$zipName" >> $env:GITHUB_ENV
93116
shell: pwsh
94117

118+
- name: Rename installer
119+
run: |
120+
$version = "v${{ github.run_number }}"
121+
$installerPath = Get-ChildItem "installer/src-tauri/target/release/bundle/nsis/*.exe" | Select-Object -First 1
122+
$newName = "LoArchive-${version}-setup.exe"
123+
Copy-Item $installerPath.FullName $newName
124+
echo "INSTALLER_NAME=$newName" >> $env:GITHUB_ENV
125+
shell: pwsh
126+
95127
- name: Create Release
96128
uses: softprops/action-gh-release@v2
97129
with:
@@ -108,8 +140,8 @@ jobs:
108140
### 📥 下载说明
109141
| 文件 | 说明 |
110142
|------|------|
111-
| `LoArchive_*_x64-setup.exe` | 🎯 **安装版**(推荐,有开始菜单快捷方式) |
112-
| `LoArchive-*-portable.zip` | 📦 **便携版**(解压即用,无需安装) |
143+
| `LoArchive-v*-setup.exe` | 🎯 **安装版**(推荐,自定义安装程序) |
144+
| `LoArchive-v*-portable.zip` | 📦 **便携版**(解压即用,无需安装) |
113145
114146
### 🔧 使用方法
115147
1. 下载安装版或便携版
@@ -128,7 +160,7 @@ jobs:
128160
---
129161
<sub>构建时间: ${{ github.event.head_commit.timestamp }}</sub>
130162
files: |
131-
src-tauri/target/release/bundle/nsis/*.exe
163+
LoArchive-v${{ github.run_number }}-setup.exe
132164
LoArchive-v${{ github.run_number }}-portable.zip
133165
draft: false
134166
prerelease: false

0 commit comments

Comments
 (0)