From 3352a59ff9c90d09b080f82e04e06c881becea80 Mon Sep 17 00:00:00 2001 From: Gitea Actions Bot Date: Sat, 11 Oct 2025 16:15:22 +0800 Subject: [PATCH] =?UTF-8?q?[patch]=20=E4=BF=AE=E6=94=B9nsis=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/gui-version-release.yml | 134 ++++++++++++++--------- config.py | 2 +- version_history.json | 16 +++ 3 files changed, 97 insertions(+), 55 deletions(-) diff --git a/.gitea/workflows/gui-version-release.yml b/.gitea/workflows/gui-version-release.yml index 48cfde1..dca97ee 100644 --- a/.gitea/workflows/gui-version-release.yml +++ b/.gitea/workflows/gui-version-release.yml @@ -149,7 +149,7 @@ jobs: Write-Host "Production build completed successfully"; Write-Host ""; - # Step 4.6: Install NSIS + # Step 4.6: Install NSIS using Chocolatey - name: Install NSIS if: success() shell: powershell @@ -158,94 +158,120 @@ jobs: Write-Host "Step 4.6: Install NSIS"; Write-Host "=========================================="; - # Use current directory for installer to avoid permission issues + # Method 1: Try Chocolatey (fastest and most reliable) + Write-Host "Checking if Chocolatey is available..."; + $chocoInstalled = Get-Command choco -ErrorAction SilentlyContinue; + + if ($chocoInstalled) { + Write-Host "Installing NSIS via Chocolatey..."; + choco install nsis -y --no-progress; + + if ($LASTEXITCODE -eq 0) { + Write-Host "NSIS installed successfully via Chocolatey"; + + # Refresh environment + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User"); + + # Verify installation + $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"; + 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"; - - Write-Host "Downloading NSIS installer..."; - Write-Host "Target path: $nsisInstaller"; - - # Try multiple sources $downloaded = $false; - # Source 1: Direct download from GitHub mirror + # Try direct download link (no redirect) try { - $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; + 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 / 1MB; - Write-Host "Downloaded successfully: $([math]::Round($fileSize, 2)) MB"; - $downloaded = $true; + $fileSize = (Get-Item $nsisInstaller).Length; + $fileSizeMB = $fileSize / 1MB; + Write-Host "Downloaded: $([math]::Round($fileSizeMB, 2)) MB"; + + if ($fileSize -gt 1000000) { + $downloaded = $true; + } else { + Write-Host "File too small, trying next source..."; + } } } catch { - Write-Host "Source 1 failed: $_"; + Write-Host "fossies.org failed: $_"; } - # Source 2: SourceForge + # Try another mirror 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; + 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 / 1MB; - Write-Host "Downloaded successfully: $([math]::Round($fileSize, 2)) MB"; - $downloaded = $true; + $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 "Source 2 failed: $_"; + Write-Host "GitHub release failed: $_"; } } if (-not $downloaded) { - Write-Host "ERROR: All download sources failed"; + Write-Host "ERROR: All download methods 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..."; + Write-Host "Installing NSIS..."; Start-Process -FilePath $nsisInstaller -ArgumentList "/S" -Wait -NoNewWindow; - - # Wait for installation to complete Start-Sleep -Seconds 5; - # Add NSIS to PATH + # Add to PATH $nsisPath = "C:\Program Files (x86)\NSIS"; if (-not (Test-Path $nsisPath)) { - # Try x64 path $nsisPath = "C:\Program Files\NSIS"; } if (Test-Path $nsisPath) { $env:Path = "$nsisPath;$env:Path"; - Write-Host "NSIS path added: $nsisPath"; + $makensisPath = Join-Path $nsisPath "makensis.exe"; + + 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 installation directory not found"; + Write-Host "ERROR: NSIS directory not found"; exit 1; } - Write-Host "Verifying NSIS installation..."; - $makensisPath = Join-Path $nsisPath "makensis.exe"; - if (Test-Path $makensisPath) { - & $makensisPath /VERSION; - Write-Host "NSIS installed successfully"; - } else { - Write-Host "ERROR: makensis.exe not found at $makensisPath"; - exit 1; - } - - # Clean up installer Remove-Item $nsisInstaller -ErrorAction SilentlyContinue; Write-Host ""; diff --git a/config.py b/config.py index daaac7a..df9f6a9 100644 --- a/config.py +++ b/config.py @@ -42,7 +42,7 @@ VERSION = "1.0" WINDOW_TITLE = "AI回复连接入口-V1.0" # 应用版本号(用于版本检查) -APP_VERSION = "1.5.3" +APP_VERSION = "1.5.4" # 平台特定配置 PLATFORMS = { diff --git a/version_history.json b/version_history.json index 1203708..79bfc77 100644 --- a/version_history.json +++ b/version_history.json @@ -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", "update_type": "patch",