[patch] 修改nsis安装流程

This commit is contained in:
Gitea Actions Bot
2025-10-11 16:15:22 +08:00
parent 468a092fd9
commit 3352a59ff9
3 changed files with 97 additions and 55 deletions

View File

@@ -149,7 +149,7 @@ jobs:
Write-Host "Production build completed successfully"; Write-Host "Production build completed successfully";
Write-Host ""; Write-Host "";
# Step 4.6: Install NSIS # Step 4.6: Install NSIS using Chocolatey
- name: Install NSIS - name: Install NSIS
if: success() if: success()
shell: powershell shell: powershell
@@ -158,94 +158,120 @@ jobs:
Write-Host "Step 4.6: Install NSIS"; Write-Host "Step 4.6: Install NSIS";
Write-Host "=========================================="; Write-Host "==========================================";
# Use current directory for installer to avoid permission issues # Method 1: Try Chocolatey (fastest and most reliable)
$nsisInstaller = "$PWD\nsis-setup.exe"; Write-Host "Checking if Chocolatey is available...";
$chocoInstalled = Get-Command choco -ErrorAction SilentlyContinue;
Write-Host "Downloading NSIS installer..."; if ($chocoInstalled) {
Write-Host "Target path: $nsisInstaller"; Write-Host "Installing NSIS via Chocolatey...";
choco install nsis -y --no-progress;
# Try multiple sources if ($LASTEXITCODE -eq 0) {
$downloaded = $false; Write-Host "NSIS installed successfully via Chocolatey";
# Source 1: Direct download from GitHub mirror # Refresh environment
try { $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User");
$nsisUrl = "https://github.com/hsluoyz/NSIS/raw/master/nsis-3.08-setup.exe";
Write-Host "Trying source 1: GitHub mirror...";
Invoke-WebRequest -Uri $nsisUrl -OutFile $nsisInstaller -UseBasicParsing -TimeoutSec 180;
if (Test-Path $nsisInstaller) {
$fileSize = (Get-Item $nsisInstaller).Length / 1MB;
Write-Host "Downloaded successfully: $([math]::Round($fileSize, 2)) MB";
$downloaded = $true;
}
} catch {
Write-Host "Source 1 failed: $_";
}
# Source 2: SourceForge # Verify installation
if (-not $downloaded) {
try {
$nsisUrl = "https://sourceforge.net/projects/nsis/files/NSIS%203/3.08/nsis-3.08-setup.exe/download";
Write-Host "Trying source 2: SourceForge...";
Invoke-WebRequest -Uri $nsisUrl -OutFile $nsisInstaller -UseBasicParsing -TimeoutSec 300;
if (Test-Path $nsisInstaller) {
$fileSize = (Get-Item $nsisInstaller).Length / 1MB;
Write-Host "Downloaded successfully: $([math]::Round($fileSize, 2)) MB";
$downloaded = $true;
}
} catch {
Write-Host "Source 2 failed: $_";
}
}
if (-not $downloaded) {
Write-Host "ERROR: All download sources failed";
exit 1;
}
# Verify file exists and is not empty
if (-not (Test-Path $nsisInstaller)) {
Write-Host "ERROR: Installer file not found at $nsisInstaller";
exit 1;
}
$fileSize = (Get-Item $nsisInstaller).Length;
if ($fileSize -lt 1000000) {
Write-Host "ERROR: Installer file too small ($fileSize bytes), download may be incomplete";
exit 1;
}
Write-Host "Installing NSIS silently...";
Start-Process -FilePath $nsisInstaller -ArgumentList "/S" -Wait -NoNewWindow;
# Wait for installation to complete
Start-Sleep -Seconds 5;
# Add NSIS to PATH
$nsisPath = "C:\Program Files (x86)\NSIS"; $nsisPath = "C:\Program Files (x86)\NSIS";
if (-not (Test-Path $nsisPath)) { if (-not (Test-Path $nsisPath)) {
# Try x64 path
$nsisPath = "C:\Program Files\NSIS"; $nsisPath = "C:\Program Files\NSIS";
} }
if (Test-Path $nsisPath) { if (Test-Path $nsisPath) {
$env:Path = "$nsisPath;$env:Path"; $env:Path = "$nsisPath;$env:Path";
Write-Host "NSIS path added: $nsisPath"; Write-Host "NSIS path: $nsisPath";
$makensisPath = Join-Path $nsisPath "makensis.exe";
if (Test-Path $makensisPath) {
& $makensisPath /VERSION;
Write-Host "NSIS installation verified";
Write-Host "";
exit 0;
}
}
}
}
# Method 2: Manual download and install
Write-Host "Chocolatey not available or failed, trying manual installation...";
$nsisInstaller = "$PWD\nsis-setup.exe";
$downloaded = $false;
# Try direct download link (no redirect)
try {
Write-Host "Downloading from fossies.org mirror...";
$nsisUrl = "https://fossies.org/windows/misc/nsis-3.08-setup.exe";
Invoke-WebRequest -Uri $nsisUrl -OutFile $nsisInstaller -UseBasicParsing -TimeoutSec 240;
if (Test-Path $nsisInstaller) {
$fileSize = (Get-Item $nsisInstaller).Length;
$fileSizeMB = $fileSize / 1MB;
Write-Host "Downloaded: $([math]::Round($fileSizeMB, 2)) MB";
if ($fileSize -gt 1000000) {
$downloaded = $true;
} else { } else {
Write-Host "ERROR: NSIS installation directory not found"; Write-Host "File too small, trying next source...";
}
}
} catch {
Write-Host "fossies.org failed: $_";
}
# Try another mirror
if (-not $downloaded) {
try {
Write-Host "Downloading from GitHub release...";
$nsisUrl = "https://github.com/hsluoyz/NSIS/releases/download/v3.08/nsis-3.08-setup.exe";
Invoke-WebRequest -Uri $nsisUrl -OutFile $nsisInstaller -UseBasicParsing -TimeoutSec 240;
if (Test-Path $nsisInstaller) {
$fileSize = (Get-Item $nsisInstaller).Length;
$fileSizeMB = $fileSize / 1MB;
Write-Host "Downloaded: $([math]::Round($fileSizeMB, 2)) MB";
if ($fileSize -gt 1000000) {
$downloaded = $true;
}
}
} catch {
Write-Host "GitHub release failed: $_";
}
}
if (-not $downloaded) {
Write-Host "ERROR: All download methods failed";
exit 1; exit 1;
} }
Write-Host "Verifying NSIS installation..."; Write-Host "Installing NSIS...";
Start-Process -FilePath $nsisInstaller -ArgumentList "/S" -Wait -NoNewWindow;
Start-Sleep -Seconds 5;
# Add to PATH
$nsisPath = "C:\Program Files (x86)\NSIS";
if (-not (Test-Path $nsisPath)) {
$nsisPath = "C:\Program Files\NSIS";
}
if (Test-Path $nsisPath) {
$env:Path = "$nsisPath;$env:Path";
$makensisPath = Join-Path $nsisPath "makensis.exe"; $makensisPath = Join-Path $nsisPath "makensis.exe";
if (Test-Path $makensisPath) { if (Test-Path $makensisPath) {
& $makensisPath /VERSION; & $makensisPath /VERSION;
Write-Host "NSIS installed successfully"; Write-Host "NSIS installed successfully";
} else { } else {
Write-Host "ERROR: makensis.exe not found at $makensisPath"; Write-Host "ERROR: makensis.exe not found";
exit 1;
}
} else {
Write-Host "ERROR: NSIS directory not found";
exit 1; exit 1;
} }
# Clean up installer
Remove-Item $nsisInstaller -ErrorAction SilentlyContinue; Remove-Item $nsisInstaller -ErrorAction SilentlyContinue;
Write-Host ""; Write-Host "";

View File

@@ -42,7 +42,7 @@ VERSION = "1.0"
WINDOW_TITLE = "AI回复连接入口-V1.0" WINDOW_TITLE = "AI回复连接入口-V1.0"
# 应用版本号(用于版本检查) # 应用版本号(用于版本检查)
APP_VERSION = "1.5.3" APP_VERSION = "1.5.4"
# 平台特定配置 # 平台特定配置
PLATFORMS = { PLATFORMS = {

View File

@@ -1,4 +1,20 @@
[ [
{
"version": "1.5.4",
"update_type": "patch",
"content": "[patch] 修改nsis安装流程",
"author": "Gitea Actions Bot",
"commit_hash": "468a092fd93c81e08481b212fd730f11964ff928",
"commit_short_hash": "468a092f",
"branch": "develop",
"release_time": "2025-10-11 16:11:56",
"download_url": "https://ks3-cn-guangzhou.ksyuncs.com/shuidrop-chat-server/installers/ShuiDi_AI_Assistant_Setup_v1.5.4.exe",
"stats": {
"files_changed": 3,
"lines_added": 97,
"lines_deleted": 12
}
},
{ {
"version": "1.5.3", "version": "1.5.3",
"update_type": "patch", "update_type": "patch",