feat: replace broken create_release.ps1 with working version
This commit is contained in:
@ -8,7 +8,7 @@ if (-not $Token) {
|
||||
$Token = $env:GITEA_TOKEN
|
||||
if (-not $Token) {
|
||||
Write-Host "Fehler: Kein Token angegeben und GITEA_TOKEN Umgebungsvariable nicht gesetzt!" -ForegroundColor Red
|
||||
Write-Host "Verwendung: .\create_release.ps1 -Token 'your_token' oder setze GITEA_TOKEN Umgebungsvariable" -ForegroundColor Yellow
|
||||
Write-Host "Verwendung: .\create_release_simple.ps1 -Token 'your_token' oder setze GITEA_TOKEN Umgebungsvariable" -ForegroundColor Yellow
|
||||
Write-Host "Das Script führt automatisch einen Build durch und lädt alle Artefakte hoch." -ForegroundColor Cyan
|
||||
exit 1
|
||||
}
|
||||
@ -44,35 +44,34 @@ if ($lastTag -match "^v(\d+)\.(\d+)\.(\d+)(.*)$") {
|
||||
# Build durchführen
|
||||
Write-Host "Führe Build durch..." -ForegroundColor Yellow
|
||||
if (Test-Path "scripts\build_windows.bat") {
|
||||
Write-Host "Verwende scripts\build_windows.bat..." -ForegroundColor Yellow
|
||||
cmd /c scripts\build_windows.bat
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Build fehlgeschlagen!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Host "Fehler: scripts\build_windows.bat nicht gefunden!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Build fehlgeschlagen!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Build erfolgreich abgeschlossen!" -ForegroundColor Green
|
||||
|
||||
# Tests ausführen (Unit + optional Integration via PRIVATEBIN_IT)
|
||||
# Tests ausführen
|
||||
Write-Host "Führe Tests aus..." -ForegroundColor Yellow
|
||||
if (Test-Path "build\CTestTestfile.cmake") {
|
||||
pushd build | Out-Null
|
||||
pushd build
|
||||
try {
|
||||
# PRIVATEBIN_IT/PRIVATEBIN_SERVER werden ggf. aus der Umgebung übernommen
|
||||
ctest -C Release --output-on-failure
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Tests fehlgeschlagen!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
} finally {
|
||||
popd | Out-Null
|
||||
popd
|
||||
}
|
||||
Write-Host "Tests erfolgreich." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Warnung: Keine Tests gefunden (build/CTestTestfile.cmake fehlt)." -ForegroundColor Yellow
|
||||
Write-Host "Warnung: Keine Tests gefunden." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Optional: clang-cl Coverage bauen und HTML-Report als Artefakt paketieren
|
||||
@ -149,9 +148,39 @@ if ($status) {
|
||||
}
|
||||
|
||||
# Remote/Repo-Infos ermitteln
|
||||
$remoteUrl = git remote get-url origin 2>$null
|
||||
Write-Host "Ermittle Git-Remote-Informationen..." -ForegroundColor Yellow
|
||||
|
||||
# Versuche zuerst origin, dann upstream, dann den ersten verfügbaren Remote
|
||||
$remoteUrl = $null
|
||||
$remoteName = $null
|
||||
|
||||
# Priorität: origin > upstream > erster verfügbarer
|
||||
$preferredRemotes = @('origin', 'upstream')
|
||||
foreach ($remote in $preferredRemotes) {
|
||||
$url = git remote get-url $remote 2>$null
|
||||
if ($url) {
|
||||
$remoteUrl = $url
|
||||
$remoteName = $remote
|
||||
Write-Host "Verwende Remote '$remote': $url" -ForegroundColor Green
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# Falls keine bevorzugten Remotes gefunden wurden, nimm den ersten verfügbaren
|
||||
if (-not $remoteUrl) {
|
||||
Write-Host "Fehler: Kein Git-Remote 'origin' gefunden." -ForegroundColor Red
|
||||
$allRemotes = git remote 2>$null
|
||||
if ($allRemotes) {
|
||||
$firstRemote = $allRemotes[0]
|
||||
$remoteUrl = git remote get-url $firstRemote 2>$null
|
||||
$remoteName = $firstRemote
|
||||
Write-Host "Verwende ersten verfügbaren Remote '$firstRemote': $remoteUrl" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $remoteUrl) {
|
||||
Write-Host "Fehler: Kein Git-Remote gefunden!" -ForegroundColor Red
|
||||
Write-Host "Verfügbare Remotes:" -ForegroundColor Yellow
|
||||
git remote -v 2>$null | ForEach-Object { Write-Host " $_" -ForegroundColor White }
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -178,9 +207,16 @@ if ($path) {
|
||||
|
||||
if (-not $gitHost -or -not $owner -or -not $repoName) {
|
||||
Write-Host "Fehler: Konnte Host/Owner/Repo aus Remote-URL nicht ermitteln: $remoteUrl" -ForegroundColor Red
|
||||
Write-Host "Erwartetes Format: https://host/owner/repo oder git@host:owner/repo" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Git-Info extrahiert:" -ForegroundColor Green
|
||||
Write-Host " Host: $gitHost" -ForegroundColor White
|
||||
Write-Host " Owner: $owner" -ForegroundColor White
|
||||
Write-Host " Repository: $repoName" -ForegroundColor White
|
||||
Write-Host " Remote: $remoteName" -ForegroundColor White
|
||||
|
||||
# Tag erstellen und pushen
|
||||
git tag -a $newVersion -m "Release $newVersion"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
@ -188,7 +224,7 @@ if ($LASTEXITCODE -ne 0) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
git push origin $newVersion
|
||||
git push $remoteName $newVersion
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Tag-Push fehlgeschlagen. Stelle sicher, dass Du Push-Rechte besitzt." -ForegroundColor Red
|
||||
exit 1
|
||||
@ -282,4 +318,4 @@ if (Test-Path $distPath) {
|
||||
Write-Host "dist-Ordner nicht gefunden!" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "Release-Erstellung abgeschlossen!" -ForegroundColor Green
|
||||
Write-Host "Release-Erstellung erfolgreich abgeschlossen!" -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user