- Add cross-platform support for Windows (vcpkg) and Linux (system packages) - Improve dependency handling for cryptopp and nlohmann-json - Update build scripts for better release management - Enhance CHANGELOG.md with latest version information
50 lines
1.4 KiB
PowerShell
50 lines
1.4 KiB
PowerShell
param(
|
|
[Parameter(Mandatory=$true)][string]$Server,
|
|
[Parameter(Mandatory=$true)][string]$Owner,
|
|
[Parameter(Mandatory=$true)][string]$Repo,
|
|
[Parameter(Mandatory=$true)][string]$Token,
|
|
[Parameter(Mandatory=$true)][string]$Directory
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if (-not (Test-Path -LiteralPath $Directory)) {
|
|
throw "Directory not found: $Directory"
|
|
}
|
|
|
|
$headers = @{ Authorization = "token $Token" }
|
|
|
|
$latestUrl = "$Server/api/v1/repos/$Owner/$Repo/releases/latest"
|
|
$latest = Invoke-RestMethod -Headers $headers -Method GET -Uri $latestUrl
|
|
if (-not $latest -or -not $latest.id) {
|
|
throw "Failed to get latest release from $latestUrl"
|
|
}
|
|
$rid = [string]$latest.id
|
|
Write-Host "Latest release id: $rid"
|
|
|
|
$files = Get-ChildItem -LiteralPath $Directory -Recurse -File
|
|
if (-not $files) {
|
|
Write-Host "No files to upload in $Directory"
|
|
exit 0
|
|
}
|
|
|
|
foreach ($f in $files) {
|
|
$name = $f.Name
|
|
$escapedName = [System.Uri]::EscapeDataString($name)
|
|
$uploadUrl = "$Server/api/v1/repos/$Owner/$Repo/releases/$rid/assets?name=$escapedName"
|
|
Write-Host "Uploading $name ..."
|
|
try {
|
|
$resp = Invoke-WebRequest -Headers $headers -Method Post -Uri $uploadUrl -Form @{ attachment = $f }
|
|
Write-Host " OK ($($resp.StatusCode))"
|
|
}
|
|
catch {
|
|
Write-Host " FAIL: $name -> $($_.Exception.Message)" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|