ci(打包): 优化Windows打包流程
- 使用choco统一安装7zip和Enigma Virtual Box - 改进7zip自解压包的配置和创建方式 - 移除冗余的下载和检查逻辑
This commit is contained in:
parent
f526122f33
commit
8ccfc6d272
@ -315,19 +315,11 @@ jobs:
|
||||
name: windows-release-build
|
||||
path: build/windows/x64/runner/Release/
|
||||
|
||||
- name: Download Enigma Virtual Box
|
||||
- name: Install Build Tools
|
||||
shell: powershell
|
||||
run: |
|
||||
Write-Host "下载 Enigma Virtual Box..."
|
||||
$enigmaUrl = "https://enigmaprotector.com/assets/files/enigmavb.exe"
|
||||
$enigmaPath = "C:\enigmavb.exe"
|
||||
|
||||
try {
|
||||
Invoke-WebRequest -Uri $enigmaUrl -OutFile $enigmaPath -UseBasicParsing
|
||||
Write-Host "✅ Enigma Virtual Box 下载成功"
|
||||
} catch {
|
||||
Write-Host "⚠️ 下载失败,跳过 Enigma 打包"
|
||||
}
|
||||
choco install 7zip -y
|
||||
choco install enigma-virtual-box -y
|
||||
|
||||
- name: Package Single EXE
|
||||
shell: powershell
|
||||
@ -336,7 +328,7 @@ jobs:
|
||||
|
||||
$buildPath = "build\windows\x64\runner\Release"
|
||||
$outputPath = "dist"
|
||||
$enigmaPath = "C:\enigmavb.exe"
|
||||
$enigmaPath = "C:\Program Files\Enigma Virtual Box\enigmavb.exe"
|
||||
|
||||
# 创建输出目录
|
||||
if (-not (Test-Path $outputPath)) {
|
||||
@ -397,11 +389,6 @@ jobs:
|
||||
|
||||
# 检查 7-Zip
|
||||
$7zipPath = "C:\Program Files\7-Zip\7z.exe"
|
||||
if (-not (Test-Path $7zipPath)) {
|
||||
Write-Host "安装 7-Zip..."
|
||||
choco install 7zip -y
|
||||
$7zipPath = "C:\Program Files\7-Zip\7z.exe"
|
||||
}
|
||||
|
||||
# 获取主程序名称
|
||||
$exeFile = Get-ChildItem -Path $buildPath -Filter "*.exe" | Select-Object -First 1
|
||||
@ -410,13 +397,24 @@ jobs:
|
||||
Write-Host "创建自解压包..."
|
||||
|
||||
# 创建配置文件
|
||||
$configContent = ";!@Install@!UTF-8!`nTitle=\"HostExecutor Windows Package\"`nBeginPrompt=\"正在解压 HostExecutor...\"`nExtractDialogText=\"请稍候,正在解压文件...\"`nExtractPathText=\"解压路径:\"`nExtractTitle=\"解压中\"`nFinishMessage=\"解压完成!\"`nGUIFlags=\"8\"`n;!@InstallEnd@!"
|
||||
$configContent = @"
|
||||
;!@Install@!UTF-8!
|
||||
Title="HostExecutor Windows Package"
|
||||
BeginPrompt="正在解压 HostExecutor..."
|
||||
ExtractDialogText="请稍候,正在解压文件..."
|
||||
ExtractPathText="解压路径:"
|
||||
ExtractTitle="解压中"
|
||||
FinishMessage="解压完成!"
|
||||
GUIFlags="8"
|
||||
;!@InstallEnd@!
|
||||
"@
|
||||
|
||||
$configFile = "$outputPath\config.txt"
|
||||
Set-Content -Path $configFile -Value $configContent -Encoding UTF8
|
||||
|
||||
# 创建压缩包
|
||||
& $7zipPath a -sfx "$outputSfx" "$buildPath\*" -mmt=on -mx=9
|
||||
& $7zipPath a -sfx7z.sfx -r "$outputSfx" "$buildPath\*" -scsUTF-8 -y
|
||||
Copy-Item "$configFile" -Destination "$outputSfx" -Force
|
||||
|
||||
if (Test-Path $outputSfx) {
|
||||
Write-Host "✅ 7-Zip 自解压包创建成功!"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user