docs: 添加自动打包说明并简化工作流脚本
添加详细的自动打包说明文档,介绍工作流功能和打包流程 简化 docker.yml 中的脚本内容,移除冗余代码并优化错误处理
This commit is contained in:
@@ -326,39 +326,7 @@ jobs:
|
||||
Invoke-WebRequest -Uri $enigmaUrl -OutFile $enigmaPath -UseBasicParsing
|
||||
Write-Host "✅ Enigma Virtual Box 下载成功"
|
||||
} catch {
|
||||
Write-Host "⚠️ 下载失败,使用备用方案"
|
||||
# 创建简单的自解压脚本作为备选
|
||||
$altScript = @"
|
||||
' 备选打包脚本 - 复制所有文件到输出目录
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Set shell = CreateObject("WScript.Shell")
|
||||
|
||||
srcFolder = "build\windows\x64\runner\Release"
|
||||
destFolder = "dist\windows-package"
|
||||
|
||||
If fso.FolderExists(srcFolder) Then
|
||||
If Not fso.FolderExists(destFolder) Then
|
||||
fso.CreateFolder(destFolder)
|
||||
End If
|
||||
|
||||
' 复制所有文件
|
||||
Set folder = fso.GetFolder(srcFolder)
|
||||
For Each file In folder.Files
|
||||
file.Copy destFolder & "\" & file.Name, True
|
||||
Next
|
||||
|
||||
' 复制子文件夹
|
||||
For Each subFolder In folder.SubFolders
|
||||
fso.CopyFolder subFolder.Path, destFolder & "\" & subFolder.Name, True
|
||||
Next
|
||||
|
||||
WScript.Echo "✅ 文件打包完成"
|
||||
Else
|
||||
WScript.Echo "❌ 源文件夹不存在"
|
||||
End If
|
||||
"@
|
||||
|
||||
Set-Content -Path "C:\package.vbs" -Value $altScript
|
||||
Write-Host "⚠️ 下载失败,跳过 Enigma 打包"
|
||||
}
|
||||
|
||||
- name: Package Single EXE
|
||||
@@ -393,18 +361,7 @@ jobs:
|
||||
Write-Host "使用 Enigma Virtual Box 打包..."
|
||||
|
||||
# 创建配置文件
|
||||
$configContent = @"
|
||||
[Config]
|
||||
InputFile=$inputExe
|
||||
OutputFile=$outputExe
|
||||
Files=%DEFAULT FOLDER%
|
||||
VirtualizationMode=Never Write To Disk
|
||||
Compression=Yes
|
||||
ShareVirtualSystem=Yes
|
||||
|
||||
[Files]
|
||||
Folder=$buildPath\*
|
||||
"@
|
||||
$configContent = "[Config]`nInputFile=$inputExe`nOutputFile=$outputExe`nFiles=%DEFAULT FOLDER%`nVirtualizationMode=Never Write To Disk`nCompression=Yes`nShareVirtualSystem=Yes`n`n[Files]`nFolder=$buildPath\*"
|
||||
|
||||
$configFile = "$outputPath\package_config.evb"
|
||||
Set-Content -Path $configFile -Value $configContent
|
||||
@@ -422,11 +379,11 @@ jobs:
|
||||
Write-Host "打包大小: $([math]::Round($packedSize, 2)) MB"
|
||||
} else {
|
||||
Write-Host "⚠️ Enigma 打包失败,使用备选方案"
|
||||
throw "Enigma failed"
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Host "⚠️ Enigma 未找到,使用 7-Zip 自解压方案"
|
||||
throw "Enigma not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Package with 7-Zip Alternative
|
||||
@@ -453,17 +410,7 @@ jobs:
|
||||
Write-Host "创建自解压包..."
|
||||
|
||||
# 创建配置文件
|
||||
$configContent = @"
|
||||
;!@Install@!UTF-8!
|
||||
Title="HostExecutor Windows Package"
|
||||
BeginPrompt="正在解压 HostExecutor..."
|
||||
ExtractDialogText="请稍候,正在解压文件..."
|
||||
ExtractPathText="解压路径:"
|
||||
ExtractTitle="解压中"
|
||||
FinishMessage="解压完成!"
|
||||
GUIFlags="8"
|
||||
;!@InstallEnd@!
|
||||
"@
|
||||
$configContent = ";!@Install@!UTF-8!`nTitle=\"HostExecutor Windows Package\"`nBeginPrompt=\"正在解压 HostExecutor...\"`nExtractDialogText=\"请稍候,正在解压文件...\"`nExtractPathText=\"解压路径:\"`nExtractTitle=\"解压中\"`nFinishMessage=\"解压完成!\"`nGUIFlags=\"8\"`n;!@InstallEnd@!"
|
||||
|
||||
$configFile = "$outputPath\config.txt"
|
||||
Set-Content -Path $configFile -Value $configContent -Encoding UTF8
|
||||
|
||||
Reference in New Issue
Block a user