[patch] 修改nsis安装流程
This commit is contained in:
@@ -149,131 +149,140 @@ jobs:
|
|||||||
Write-Host "Production build completed successfully";
|
Write-Host "Production build completed successfully";
|
||||||
Write-Host "";
|
Write-Host "";
|
||||||
|
|
||||||
# Step 4.6: Install NSIS using Chocolatey
|
# Step 4.6: Check or Install NSIS
|
||||||
- name: Install NSIS
|
- name: Check or Install NSIS
|
||||||
if: success()
|
if: success()
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
Write-Host "==========================================";
|
Write-Host "==========================================";
|
||||||
Write-Host "Step 4.6: Install NSIS";
|
Write-Host "Step 4.6: Check or Install NSIS";
|
||||||
Write-Host "==========================================";
|
Write-Host "==========================================";
|
||||||
|
|
||||||
# Method 1: Try Chocolatey (fastest and most reliable)
|
# Step 1: Check if NSIS is already installed
|
||||||
Write-Host "Checking if Chocolatey is available...";
|
Write-Host "Checking if NSIS is already installed...";
|
||||||
|
|
||||||
|
$nsisPaths = @(
|
||||||
|
"C:\Program Files (x86)\NSIS",
|
||||||
|
"C:\Program Files\NSIS",
|
||||||
|
"C:\Tools\NSIS",
|
||||||
|
"$env:ProgramFiles\NSIS",
|
||||||
|
"$env:ProgramFiles(x86)\NSIS"
|
||||||
|
);
|
||||||
|
|
||||||
|
$nsisFound = $false;
|
||||||
|
$nsisPath = "";
|
||||||
|
|
||||||
|
foreach ($path in $nsisPaths) {
|
||||||
|
if (Test-Path $path) {
|
||||||
|
$makensisPath = Join-Path $path "makensis.exe";
|
||||||
|
if (Test-Path $makensisPath) {
|
||||||
|
$nsisPath = $path;
|
||||||
|
$nsisFound = $true;
|
||||||
|
Write-Host "Found NSIS at: $nsisPath";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Also check if makensis is in PATH
|
||||||
|
if (-not $nsisFound) {
|
||||||
|
$makensisInPath = Get-Command makensis -ErrorAction SilentlyContinue;
|
||||||
|
if ($makensisInPath) {
|
||||||
|
$nsisPath = Split-Path $makensisInPath.Source;
|
||||||
|
$nsisFound = $true;
|
||||||
|
Write-Host "Found makensis in PATH: $nsisPath";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nsisFound) {
|
||||||
|
$env:Path = "$nsisPath;$env:Path";
|
||||||
|
Write-Host "Using existing NSIS installation";
|
||||||
|
& makensis /VERSION;
|
||||||
|
Write-Host "";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "NSIS not found, attempting installation...";
|
||||||
|
Write-Host "";
|
||||||
|
|
||||||
|
# Step 2: Try Chocolatey
|
||||||
|
Write-Host "Method 1: Trying Chocolatey...";
|
||||||
$chocoInstalled = Get-Command choco -ErrorAction SilentlyContinue;
|
$chocoInstalled = Get-Command choco -ErrorAction SilentlyContinue;
|
||||||
|
|
||||||
if ($chocoInstalled) {
|
if ($chocoInstalled) {
|
||||||
Write-Host "Installing NSIS via Chocolatey...";
|
try {
|
||||||
choco install nsis -y --no-progress;
|
choco install nsis -y --no-progress --limit-output;
|
||||||
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Host "NSIS installed successfully via Chocolatey";
|
Start-Sleep -Seconds 3;
|
||||||
|
|
||||||
# Refresh environment
|
# Refresh PATH
|
||||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User");
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User");
|
||||||
|
|
||||||
# Verify installation
|
|
||||||
$nsisPath = "C:\Program Files (x86)\NSIS";
|
$nsisPath = "C:\Program Files (x86)\NSIS";
|
||||||
if (-not (Test-Path $nsisPath)) {
|
if (-not (Test-Path $nsisPath)) {
|
||||||
$nsisPath = "C:\Program Files\NSIS";
|
$nsisPath = "C:\Program Files\NSIS";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path $nsisPath) {
|
if (Test-Path (Join-Path $nsisPath "makensis.exe")) {
|
||||||
$env:Path = "$nsisPath;$env:Path";
|
$env:Path = "$nsisPath;$env:Path";
|
||||||
Write-Host "NSIS path: $nsisPath";
|
& makensis /VERSION;
|
||||||
|
Write-Host "NSIS installed via Chocolatey";
|
||||||
$makensisPath = Join-Path $nsisPath "makensis.exe";
|
|
||||||
if (Test-Path $makensisPath) {
|
|
||||||
& $makensisPath /VERSION;
|
|
||||||
Write-Host "NSIS installation verified";
|
|
||||||
Write-Host "";
|
Write-Host "";
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "Chocolatey installation failed: $_";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# 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 "File too small, trying next source...";
|
Write-Host "Chocolatey not available";
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
Write-Host "fossies.org failed: $_";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Try another mirror
|
# Step 3: Try winget (Windows Package Manager)
|
||||||
if (-not $downloaded) {
|
Write-Host "";
|
||||||
|
Write-Host "Method 2: Trying winget...";
|
||||||
|
$wingetInstalled = Get-Command winget -ErrorAction SilentlyContinue;
|
||||||
|
|
||||||
|
if ($wingetInstalled) {
|
||||||
try {
|
try {
|
||||||
Write-Host "Downloading from GitHub release...";
|
winget install --id=NSIS.NSIS -e --silent --accept-package-agreements --accept-source-agreements;
|
||||||
$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) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
$fileSize = (Get-Item $nsisInstaller).Length;
|
Start-Sleep -Seconds 3;
|
||||||
$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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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";
|
$nsisPath = "C:\Program Files (x86)\NSIS";
|
||||||
if (-not (Test-Path $nsisPath)) {
|
if (-not (Test-Path $nsisPath)) {
|
||||||
$nsisPath = "C:\Program Files\NSIS";
|
$nsisPath = "C:\Program Files\NSIS";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path $nsisPath) {
|
if (Test-Path (Join-Path $nsisPath "makensis.exe")) {
|
||||||
$env:Path = "$nsisPath;$env:Path";
|
$env:Path = "$nsisPath;$env:Path";
|
||||||
$makensisPath = Join-Path $nsisPath "makensis.exe";
|
& makensis /VERSION;
|
||||||
|
Write-Host "NSIS installed via winget";
|
||||||
if (Test-Path $makensisPath) {
|
|
||||||
& $makensisPath /VERSION;
|
|
||||||
Write-Host "NSIS installed successfully";
|
|
||||||
} else {
|
|
||||||
Write-Host "ERROR: makensis.exe not found";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Write-Host "ERROR: NSIS directory not found";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Remove-Item $nsisInstaller -ErrorAction SilentlyContinue;
|
|
||||||
Write-Host "";
|
Write-Host "";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "winget installation failed: $_";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "winget not available";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 4: Manual installation is not possible due to network restrictions
|
||||||
|
Write-Host "";
|
||||||
|
Write-Host "========================================";
|
||||||
|
Write-Host "ERROR: NSIS is not installed and automatic installation failed";
|
||||||
|
Write-Host "";
|
||||||
|
Write-Host "Please install NSIS manually on the CI/CD runner:";
|
||||||
|
Write-Host "1. Download from: https://nsis.sourceforge.io/Download";
|
||||||
|
Write-Host "2. Install to: C:\Program Files (x86)\NSIS";
|
||||||
|
Write-Host "3. Or use: choco install nsis";
|
||||||
|
Write-Host "4. Or use: winget install NSIS.NSIS";
|
||||||
|
Write-Host "========================================";
|
||||||
|
exit 1;
|
||||||
|
|
||||||
# Step 4.7: Build NSIS installer
|
# Step 4.7: Build NSIS installer
|
||||||
- name: Build NSIS installer
|
- name: Build NSIS installer
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ VERSION = "1.0"
|
|||||||
WINDOW_TITLE = "AI回复连接入口-V1.0"
|
WINDOW_TITLE = "AI回复连接入口-V1.0"
|
||||||
|
|
||||||
# 应用版本号(用于版本检查)
|
# 应用版本号(用于版本检查)
|
||||||
APP_VERSION = "1.5.4"
|
APP_VERSION = "1.5.5"
|
||||||
|
|
||||||
# 平台特定配置
|
# 平台特定配置
|
||||||
PLATFORMS = {
|
PLATFORMS = {
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "1.5.5",
|
||||||
|
"update_type": "patch",
|
||||||
|
"content": "[patch] 修改nsis安装流程",
|
||||||
|
"author": "Gitea Actions Bot",
|
||||||
|
"commit_hash": "3352a59ff9c90d09b080f82e04e06c881becea80",
|
||||||
|
"commit_short_hash": "3352a59f",
|
||||||
|
"branch": "develop",
|
||||||
|
"release_time": "2025-10-11 16:16:08",
|
||||||
|
"download_url": "https://ks3-cn-guangzhou.ksyuncs.com/shuidrop-chat-server/installers/ShuiDi_AI_Assistant_Setup_v1.5.5.exe",
|
||||||
|
"stats": {
|
||||||
|
"files_changed": 3,
|
||||||
|
"lines_added": 96,
|
||||||
|
"lines_deleted": 54
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "1.5.4",
|
"version": "1.5.4",
|
||||||
"update_type": "patch",
|
"update_type": "patch",
|
||||||
|
|||||||
Reference in New Issue
Block a user