修复 Windows 安装器构建路径

This commit is contained in:
Christ committed 2026-08-13 15:08:46 +08:00
1 parent ca00c159f0
commit 59b1061ec5
2 files changed
+44 -9

No files matched your search

+35 -4
View File
@@ -387,7 +387,29 @@ jobs:
env:
APP_VERSION: ${{ env.APP_VERSION }}
run: |
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /Qp /O"dist\windows" packaging\windows\installer.iss
$requiredSources = @(
'dist/windows/xianyu-server.exe',
'dist/windows/xianyu-tray.exe',
'dist/windows/playwright-runtime/amd64',
'icon/windows/icon.ico',
'packaging/windows/service-control.ps1'
)
foreach ($source in $requiredSources) {
if (-not (Test-Path -LiteralPath $source)) {
throw "Windows 安装器源文件或目录不存在: $source"
}
}
if ($null -eq (Get-ChildItem -LiteralPath 'dist/windows/playwright-runtime/amd64' -Recurse -File | Select-Object -First 1)) {
throw 'Windows 安装器 Playwright runtime 为空'
}
$compiler = 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'
$scriptPath = (Resolve-Path 'packaging/windows/installer.iss').Path
$outputDir = (Resolve-Path 'dist/windows').Path
& $compiler /Qp "/O$outputDir" $scriptPath
if ($LASTEXITCODE -ne 0) {
throw "Inno Setup 编译失败,错误码: $LASTEXITCODE"
}
$installer = Get-ChildItem -Path dist/windows -Filter 'Ydisks-Xianyu-Helper-Setup.exe' -Recurse | Select-Object -First 1
if ($null -eq $installer) { throw 'Inno Setup 未生成安装器' }
$target = Join-Path (Resolve-Path dist/windows) 'Ydisks-Xianyu-Helper-Setup.exe'
@@ -431,9 +453,18 @@ jobs:
$expectedServer = Join-Path $installDir 'xianyu-server.exe'
$expectedRuntime = Join-Path $installDir 'playwright-runtime'
$serviceConfig = Get-CimInstance -ClassName Win32_Service -Filter "Name='$serviceName'" -ErrorAction Stop
if ($null -eq $serviceConfig -or
-not $serviceConfig.PathName.Contains(('"{0}"' -f $expectedServer)) -or
-not $serviceConfig.PathName.Contains(('-playwright-runtime-root "{0}"' -f $expectedRuntime))) {
$actualServiceCommand = if ($null -eq $serviceConfig) { '' } else { $serviceConfig.PathName.Replace('"', '') }
$requiredServiceArguments = @(
$expectedServer,
'-service',
"-playwright-runtime-root $expectedRuntime"
)
$invalidServiceArgument = $requiredServiceArguments |
Where-Object {
$actualServiceCommand.IndexOf($_, [StringComparison]::OrdinalIgnoreCase) -lt 0
} |
Select-Object -First 1
if ($null -ne $invalidServiceArgument) {
throw "安装器注册的服务命令行不正确: $($serviceConfig.PathName)"
}
+9 -5
View File
@@ -3,6 +3,10 @@
#define AppPublisher "Christ9038"
#define AppExeName "xianyu-server.exe"
#define AppDataDir "{commonappdata}\YdisksXianyuHelper"
#define RepoRoot AddBackslash(SourcePath) + "..\.."
#define WindowsDistDir AddBackslash(RepoRoot) + "dist\windows"
#define WindowsRuntimeDir AddBackslash(WindowsDistDir) + "playwright-runtime\amd64"
#define WindowsIconDir AddBackslash(RepoRoot) + "icon\windows"
[Setup]
AppId={{A6E8B04B-3C8A-4E20-AE62-6B1C3F6B31AE}
@@ -16,15 +20,15 @@ PrivilegesRequired=admin
ArchitecturesInstallIn64BitMode=x64compatible
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\icon.ico
SetupIconFile=..\..\icon\windows\icon.ico
SetupIconFile={#WindowsIconDir}\icon.ico
Compression=lzma2
SolidCompression=yes
[Files]
Source: "..\..\dist\windows\xianyu-server.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\dist\windows\xianyu-tray.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\icon\windows\icon.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\dist\windows\playwright-runtime\*"; DestDir: "{app}\playwright-runtime"; Flags: recursesubdirs createallsubdirs ignoreversion
Source: "{#WindowsDistDir}\xianyu-server.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#WindowsDistDir}\xianyu-tray.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#WindowsIconDir}\icon.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#WindowsRuntimeDir}\*"; DestDir: "{app}\playwright-runtime"; Flags: recursesubdirs createallsubdirs ignoreversion
Source: "service-control.ps1"; Flags: dontcopy
Source: "service-control.ps1"; DestDir: "{app}"; Flags: ignoreversion