From 15d68a9ba93e962f2eb460fa57e9a46ee2fa318d Mon Sep 17 00:00:00 2001 From: claudi Date: Wed, 28 Jan 2026 15:53:39 +0100 Subject: [PATCH] feat: Add MSI installer upload to Forgejo releases --- build/scripts/create_release.ps1 | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/build/scripts/create_release.ps1 b/build/scripts/create_release.ps1 index 4564045..1f9abaa 100644 --- a/build/scripts/create_release.ps1 +++ b/build/scripts/create_release.ps1 @@ -18,7 +18,8 @@ param( [string]$ForgejoUrl = "https://git.him-tools.de", [string]$Repo = "HIM-public/webdrop-bridge", [string]$ExePath = "build\dist\windows\WebDropBridge.exe", - [string]$ChecksumPath = "build\dist\windows\WebDropBridge.exe.sha256" + [string]$ChecksumPath = "build\dist\windows\WebDropBridge.exe.sha256", + [string]$MsiPath = "build\dist\windows\WebDropBridge-1.0.0-Setup.msi" ) $ErrorActionPreference = "Stop" @@ -78,6 +79,9 @@ if (-not (Test-Path $ChecksumPath)) { exit 1 } +# MSI is optional (only available on Windows after build) +$hasMsi = Test-Path $MsiPath + Write-Host "Creating WebDropBridge $Version release on Forgejo..." -ForegroundColor Cyan # Get file info @@ -85,6 +89,10 @@ $exeSize = (Get-Item $ExePath).Length / 1MB $checksum = Get-Content $ChecksumPath -Raw Write-Host "File: WebDropBridge.exe ($([math]::Round($exeSize, 2)) MB)" +if ($hasMsi) { + $msiSize = (Get-Item $MsiPath).Length / 1MB + Write-Host "File: WebDropBridge-1.0.0-Setup.msi ($([math]::Round($msiSize, 2)) MB)" +} Write-Host "Checksum: $($checksum.Substring(0, 16))..." # Create basic auth header @@ -170,5 +178,28 @@ catch { exit 1 } +# Step 4: Upload MSI as asset (if available) +if ($hasMsi) { + Write-Host "Uploading MSI installer asset..." -ForegroundColor Yellow + + try { + $response = curl.exe -s -X POST ` + -u $curlAuth ` + -F "attachment=@$MsiPath" ` + $uploadUrl + + if ($response -like "*error*" -or $response -like "*404*") { + Write-Host "ERROR uploading MSI: $response" -ForegroundColor Red + exit 1 + } + + Write-Host "[OK] MSI uploaded" -ForegroundColor Green + } + catch { + Write-Host "ERROR uploading MSI: $_" -ForegroundColor Red + exit 1 + } +} + Write-Host "`n[OK] Release complete!" -ForegroundColor Green Write-Host "View at: $ForgejoUrl/$Repo/releases/tag/v$Version" -ForegroundColor Cyan