From 9fbe46ca8269c0173f0eb47be94fe0e378017ec5 Mon Sep 17 00:00:00 2001 From: fristyxd Date: Sat, 5 Sep 2026 02:12:09 +0300 Subject: [PATCH] ci: add Velopack packaging script and release job - scripts/release/package-velopack.ps1: self-contained publish + vpk pack - release job: runs package-velopack.ps1, uploads Setup.exe + Portable.zip - Artifact names: RGBLedStripController-Setup--win-x64, RGBLedStripController-Portable--win-x64 --- .gitea/workflows/ci.yml | 22 ++++++-- scripts/release/package-velopack.ps1 | 84 ++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 scripts/release/package-velopack.ps1 diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 5aa5927..f6ad0a4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -147,14 +147,26 @@ jobs: - name: Restore tools run: dotnet tool restore - - name: Publish (Release, self-contained, single file) - run: dotnet publish src/RgbLedStripController/RgbLedStripController.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true --configfile NuGet.Config + - name: Package with Velopack (Setup.exe + Portable.zip) + shell: pwsh + run: | + $ErrorActionPreference = "Stop" + & powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/release/package-velopack.ps1 - - name: Upload release artifacts + - name: Upload Velopack artifacts (Setup.exe + Portable.zip) uses: actions/upload-artifact@v4 with: - name: rgb-led-strip-controller-${{ gitea.ref_name || 'manual' }}-win-x64 + name: RGBLedStripController-Setup-${{ gitea.ref_name || 'manual' }}-win-x64 + path: | + artifacts/velopack/win-x64-stable/*.exe + artifacts/velopack/win-x64-stable/*.zip + if-no-files-found: error + + - name: Upload portable exe (fallback) + uses: actions/upload-artifact@v4 + with: + name: RGBLedStripController-Portable-${{ gitea.ref_name || 'manual' }}-win-x64 path: | src/RgbLedStripController/bin/Release/net8.0-windows10.0.19041.0/win-x64/publish/RgbLedStripController.exe src/RgbLedStripController/bin/Release/net8.0-windows10.0.19041.0/win-x64/publish/RgbLedStripController.pdb - if-no-files-found: error + if-no-files-found: error \ No newline at end of file diff --git a/scripts/release/package-velopack.ps1 b/scripts/release/package-velopack.ps1 new file mode 100644 index 0000000..4e51f40 --- /dev/null +++ b/scripts/release/package-velopack.ps1 @@ -0,0 +1,84 @@ +<# +.SYNOPSIS + Velopack ile Setup.exe üretimi. Self-contained publish alıp vpk pack yapar. + +.DESCRIPTION + 1. Proje dosyasından sürüm okur + 2. dotnet publish (self-contained, single-file, win-x64) + 3. vpk pack ile Setup.exe ve Portable.zip üretir + 4. Çıktı: artifacts/velopack/win-x64-stable/ + +.NOTES + Velopack CLI: dotnet tool restore ile yüklenen vpk kullanılır + Icon: Assets/AppIcon.ico (installer ikonu) +#> + +param( + [switch]$WhatIf +) + +$ErrorActionPreference = "Stop" +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$repoRoot = Split-Path -Parent (Split-Path -Parent $scriptDir) +$projPath = Join-Path $repoRoot "src\RgbLedStripController\RgbLedStripController.csproj" +$iconPath = Join-Path $repoRoot "src\RgbLedStripController\Assets\AppIcon.ico" +$publishDir = Join-Path $repoRoot "artifacts\publish\win-x64" +$velopackDir = Join-Path $repoRoot "artifacts\velopack\win-x64-stable" + +# Sürümü csproj'dan oku +$projXml = [xml](Get-Content $projPath) +$version = $projXml.Project.PropertyGroup.Version +if (-not $version) { throw "Version not found in csproj" } +Write-Host "Version: $version" -ForegroundColor Cyan + +# Publish output klasörü +$stagedPublishDir = Join-Path $publishDir $version +if (-not $WhatIf) { + if (Test-Path $stagedPublishDir) { Remove-Item -Recurse -Force $stagedPublishDir } +} else { + Write-Host "[WhatIf] Would clean: $stagedPublishDir" +} + +# 1. dotnet publish +$publishArgs = @( + "publish", $projPath + "-c", "Release" + "-r", "win-x64" + "--self-contained", "true" + "-p:PublishSingleFile=true" + "-p:PublishTrimmed=false" + "-p:IncludeNativeLibrariesForSelfExtract=true" + "-p:DebugType=none" + "-p:DebugSymbols=false" + "--configfile", (Join-Path $repoRoot "NuGet.Config") + "-o", $stagedPublishDir +) +Write-Host "dotnet publish..." -ForegroundColor Cyan +if (-not $WhatIf) { + & dotnet $publishArgs +} else { + Write-Host "[WhatIf] dotnet $publishArgs" +} + +# 2. vpk pack +$vpkArgs = @( + "pack", + "--output-dir", $velopackDir, + "--pack-id", "Fristy.RgbLedStripController", + "--pack-title", "RGB Led Strip Controller", + "--pack-authors", "fristy", + "--pack-version", $version, + "--icon", $iconPath, + $stagedPublishDir +) +Write-Host "vpk pack..." -ForegroundColor Cyan +if (-not $WhatIf) { + & dotnet tool run vpk $vpkArgs +} else { + Write-Host "[WhatIf] dotnet tool run vpk $vpkArgs" +} + +Write-Host "Done. Output: $velopackDir" -ForegroundColor Green +if (-not $WhatIf) { + Get-ChildItem $velopackDir | ForEach-Object { Write-Host " $($_.Name) - $([math]::Round($_.Length/1MB,2)) MB" } +} \ No newline at end of file