From afcd360603aa89b41f32ac59c4527103b1aa33f9 Mon Sep 17 00:00:00 2001 From: Gitea Actions Bot Date: Sat, 11 Oct 2025 16:19:58 +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 | 199 ++++++++++++----------- config.py | 2 +- version_history.json | 16 ++ 3 files changed, 121 insertions(+), 96 deletions(-) diff --git a/.gitea/workflows/gui-version-release.yml b/.gitea/workflows/gui-version-release.yml index dca97ee..e43eb71 100644 --- a/.gitea/workflows/gui-version-release.yml +++ b/.gitea/workflows/gui-version-release.yml @@ -149,131 +149,140 @@ jobs: Write-Host "Production build completed successfully"; Write-Host ""; - # Step 4.6: Install NSIS using Chocolatey - - name: Install NSIS + # Step 4.6: Check or Install NSIS + - name: Check or Install NSIS if: success() shell: powershell run: | Write-Host "=========================================="; - Write-Host "Step 4.6: Install NSIS"; + Write-Host "Step 4.6: Check or Install NSIS"; Write-Host "=========================================="; - # Method 1: Try Chocolatey (fastest and most reliable) - Write-Host "Checking if Chocolatey is available..."; + # Step 1: Check if NSIS is already installed + 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; 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"; + try { + choco install nsis -y --no-progress --limit-output; - # 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"; + if ($LASTEXITCODE -eq 0) { + Start-Sleep -Seconds 3; - $makensisPath = Join-Path $nsisPath "makensis.exe"; - if (Test-Path $makensisPath) { - & $makensisPath /VERSION; - Write-Host "NSIS installation verified"; + # Refresh PATH + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User"); + + $nsisPath = "C:\Program Files (x86)\NSIS"; + if (-not (Test-Path $nsisPath)) { + $nsisPath = "C:\Program Files\NSIS"; + } + + if (Test-Path (Join-Path $nsisPath "makensis.exe")) { + $env:Path = "$nsisPath;$env:Path"; + & makensis /VERSION; + Write-Host "NSIS installed via Chocolatey"; Write-Host ""; exit 0; } } + } catch { + Write-Host "Chocolatey installation failed: $_"; } + } else { + Write-Host "Chocolatey not available"; } - # Method 2: Manual download and install - Write-Host "Chocolatey not available or failed, trying manual installation..."; + # Step 3: Try winget (Windows Package Manager) + Write-Host ""; + Write-Host "Method 2: Trying winget..."; + $wingetInstalled = Get-Command winget -ErrorAction SilentlyContinue; - $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 { - Write-Host "File too small, trying next source..."; - } - } - } catch { - Write-Host "fossies.org failed: $_"; - } - - # Try another mirror - if (-not $downloaded) { + if ($wingetInstalled) { 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; + winget install --id=NSIS.NSIS -e --silent --accept-package-agreements --accept-source-agreements; - if (Test-Path $nsisInstaller) { - $fileSize = (Get-Item $nsisInstaller).Length; - $fileSizeMB = $fileSize / 1MB; - Write-Host "Downloaded: $([math]::Round($fileSizeMB, 2)) MB"; + if ($LASTEXITCODE -eq 0) { + Start-Sleep -Seconds 3; - if ($fileSize -gt 1000000) { - $downloaded = $true; + $nsisPath = "C:\Program Files (x86)\NSIS"; + if (-not (Test-Path $nsisPath)) { + $nsisPath = "C:\Program Files\NSIS"; + } + + if (Test-Path (Join-Path $nsisPath "makensis.exe")) { + $env:Path = "$nsisPath;$env:Path"; + & makensis /VERSION; + Write-Host "NSIS installed via winget"; + Write-Host ""; + exit 0; } } } 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"; - 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"; - - if (Test-Path $makensisPath) { - & $makensisPath /VERSION; - Write-Host "NSIS installed successfully"; - } else { - Write-Host "ERROR: makensis.exe not found"; - exit 1; + Write-Host "winget installation failed: $_"; } } else { - Write-Host "ERROR: NSIS directory not found"; - exit 1; + Write-Host "winget not available"; } - Remove-Item $nsisInstaller -ErrorAction SilentlyContinue; + # 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 - name: Build NSIS installer diff --git a/config.py b/config.py index df9f6a9..4527ac3 100644 --- a/config.py +++ b/config.py @@ -42,7 +42,7 @@ VERSION = "1.0" WINDOW_TITLE = "AI回复连接入口-V1.0" # 应用版本号(用于版本检查) -APP_VERSION = "1.5.4" +APP_VERSION = "1.5.5" # 平台特定配置 PLATFORMS = { diff --git a/version_history.json b/version_history.json index 79bfc77..52e5f50 100644 --- a/version_history.json +++ b/version_history.json @@ -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", "update_type": "patch",