<# .SYNOPSIS Packs and pushes Q-SYS plugin packages to a Gitea NuGet registry. .DESCRIPTION Runs pack.ps1, then pushes every .nupkg in dist/ to your Gitea instance. Already-published versions are skipped (--skip-duplicate), so it is safe to run repeatedly - only new version numbers actually upload. .EXAMPLE ./tools/publish.ps1 -GiteaUrl https://gitea.example.com -Owner qsys-plugins -Token $env:GITEA_TOKEN ./tools/publish.ps1 -GiteaUrl https://gitea.example.com -Owner qsys-plugins -Token xxxx -Plugin ExamplePlugin #> [CmdletBinding()] param( [string]$GiteaUrl = "https://3f4dzl.gitea.cloud", [Parameter(Mandatory)] [string]$Owner, # Gitea user or org that owns the packages [Parameter(Mandatory)] [string]$Token, # Gitea personal access token (package write scope) [string]$Plugin, [string]$OutputDir = "dist" ) $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $PSScriptRoot # 1. Pack & (Join-Path $PSScriptRoot "pack.ps1") -Plugin $Plugin -OutputDir $OutputDir # 2. Push - Gitea needs a NAMED source with basic-auth credentials; # pushing straight to the URL with --api-key fails (go-gitea/gitea#20717). $feed = "$($GiteaUrl.TrimEnd('/'))/api/packages/$Owner/nuget/index.json" $dist = Join-Path $repoRoot $OutputDir Write-Host "`nPushing to $feed" dotnet nuget remove source gitea-publish 2>$null | Out-Null dotnet nuget add source $feed --name gitea-publish ` --username publisher --password $Token --store-password-in-clear-text | Out-Null try { Get-ChildItem $dist -Filter *.nupkg | ForEach-Object { Write-Host " pushing $($_.Name) ..." dotnet nuget push $_.FullName --source gitea-publish --skip-duplicate if ($LASTEXITCODE -ne 0) { throw "Push failed for $($_.Name)" } } } finally { dotnet nuget remove source gitea-publish 2>$null | Out-Null } Write-Host "`nDone. Feed URL for Q-SYS Designer users: $feed" -ForegroundColor Green