param( [string]$Version, [string]$InstallerPath ) if (-not $Version) { Write-Host "Usage:" Write-Host "publish-release.ps1 -Version 0.1.0 -InstallerPath path\to\installer.exe" exit 1 } $projectRoot = Split-Path $PSScriptRoot -Parent $releaseDir = Join-Path $projectRoot "release" $downloadsDir = Join-Path $releaseDir "downloads" $versionFile = Join-Path $releaseDir "version.json" if (-not (Test-Path $downloadsDir)) { New-Item -ItemType Directory -Path $downloadsDir | Out-Null } if ($InstallerPath) { $targetName = "aza-$Version-setup.exe" $targetPath = Join-Path $downloadsDir $targetName Copy-Item $InstallerPath $targetPath -Force Write-Host "Installer copied to $targetPath" } $json = Get-Content $versionFile | ConvertFrom-Json $json.version = $Version $json.download_url = "https://aza-medwork.ch/downloads/aza-$Version-setup.exe" $json.published_at = (Get-Date).ToString("yyyy-MM-dd") $json | ConvertTo-Json -Depth 5 | Set-Content $versionFile Write-Host "version.json updated" Write-Host "Release prepared for version $Version"