feat: Add MSI installer upload to Forgejo releases

This commit is contained in:
claudi 2026-01-28 15:53:39 +01:00
parent 0f9fd4c730
commit 15d68a9ba9

View file

@ -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