diff --git a/build_installer.ps1 b/build_installer.ps1 index abb2a63..57631d5 100644 --- a/build_installer.ps1 +++ b/build_installer.ps1 @@ -150,7 +150,23 @@ VSVersionInfo( if ($LASTEXITCODE -ne 0) { throw "Der Release-Commit ist fehlgeschlagen." } } $sourceCommitted = $true - git push origin main + $pushTarget = "origin" + $tokenPath = @( + (Join-Path $env:LOCALAPPDATA "SyncVito\developer\gitea-token.dpapi"), + (Join-Path $env:LOCALAPPDATA "MusicBrain\developer\gitea-token.dpapi") + ) | Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | Select-Object -First 1 + if (-not [string]::IsNullOrWhiteSpace($env:GITEA_TOKEN)) { + $pushTarget = "https://Davito:$($env:GITEA_TOKEN.Trim())@gitea.davito.synology.me/Davito/SyncVito.git" + } + elseif ($tokenPath) { + try { + $sec = (Get-Content $tokenPath -Raw).Trim() | ConvertTo-SecureString + $bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($sec) + $t = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr) + $pushTarget = "https://Davito:$t@gitea.davito.synology.me/Davito/SyncVito.git" + } catch { } + } + git push $pushTarget main if ($LASTEXITCODE -ne 0) { throw "Der Quellstand konnte nicht nach Gitea gepusht werden." } }