Release v0.1.5.4 prepare for release
This commit is contained in:
@ -120,17 +120,59 @@ try {
|
||||
Write-Host "Warnung: Coverage-Erzeugung fehlgeschlagen: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
<#
|
||||
Commit & Push, Tag & Push
|
||||
#>
|
||||
# Änderungen committen
|
||||
$status = git status --porcelain
|
||||
if ($status) {
|
||||
git add -A
|
||||
git commit -m "Release $newVersion prepare for release"
|
||||
git push origin HEAD
|
||||
if ($LASTEXITCODE -ne 0) { Write-Host "Commit fehlgeschlagen." -ForegroundColor Red; exit 1 }
|
||||
}
|
||||
|
||||
# Remote/Repo-Infos ermitteln
|
||||
$remoteUrl = git remote get-url origin 2>$null
|
||||
if (-not $remoteUrl) {
|
||||
Write-Host "Fehler: Kein Git-Remote 'origin' gefunden." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Host, Owner, Repo aus URL extrahieren (https oder ssh)
|
||||
$gitHost = $null; $owner = $null; $repoName = $null
|
||||
if ($remoteUrl -match '^(https?://)([^/]+)/(.+?)(?:\.git)?$') {
|
||||
$gitHost = $matches[2]
|
||||
$path = $matches[3]
|
||||
} elseif ($remoteUrl -match '^[^@]+@([^:]+):(.+?)(?:\.git)?$') {
|
||||
$gitHost = $matches[1]
|
||||
$path = $matches[2]
|
||||
}
|
||||
if ($path) {
|
||||
$parts = $path.Split('/')
|
||||
if ($parts.Length -ge 2) {
|
||||
$owner = $parts[$parts.Length-2]
|
||||
$repoName = $parts[$parts.Length-1]
|
||||
}
|
||||
}
|
||||
if (-not $gitHost -or -not $owner -or -not $repoName) {
|
||||
Write-Host "Fehler: Konnte Host/Owner/Repo aus Remote-URL nicht ermitteln: $remoteUrl" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Tag erstellen und pushen
|
||||
git tag -a $newVersion -m "Release $newVersion"
|
||||
if ($LASTEXITCODE -ne 0) { Write-Host "Tag-Erstellung fehlgeschlagen." -ForegroundColor Red; exit 1 }
|
||||
git push origin $newVersion
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Tag-Push fehlgeschlagen. Stelle sicher, dass Du Push-Rechte besitzt." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Vor Upload: Artefakte einsammeln (dist)
|
||||
if (Test-Path "scripts\collect_binaries.ps1") {
|
||||
Write-Host "Sammle Build-Artefakte (scripts/collect_binaries.ps1)..." -ForegroundColor Yellow
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\collect_binaries.ps1
|
||||
}
|
||||
|
||||
# Release erstellen
|
||||
$releaseBody = "## What is New in $newVersion`n`n- AUTOMATED: Release created by script`n- VERSION: Bumped from $lastTag to $newVersion`n- BUILD: Automatic build with build_windows.bat`n`n## Build Artifacts`n`nBuild-Artefakte werden automatisch hochgeladen und hier angezeigt.`n`nTypische Artefakte:`n- privatebinapi.dll - Windows Dynamic Link Library`n- privatebinapi.lib - Windows Import Library`n- example.exe - Combined example program`n- privatebinapi.h - C++ header file"
|
||||
@ -148,8 +190,13 @@ $headers = @{
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
|
||||
$releaseUri = "https://gitea.medisoftware.org/api/v1/repos/Markus/lib-privatebin/releases"
|
||||
$release = Invoke-RestMethod -Uri $releaseUri -Method Post -Headers $headers -Body $releaseData
|
||||
$releaseUri = "https://$gitHost/api/v1/repos/$owner/$repoName/releases"
|
||||
try {
|
||||
$release = Invoke-RestMethod -Uri $releaseUri -Method Post -Headers $headers -Body $releaseData -ErrorAction Stop
|
||||
} catch {
|
||||
Write-Host "Fehler beim Erstellen des Releases: $($_.Exception.Message)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Release erstellt: $($release.id)" -ForegroundColor Green
|
||||
Write-Host "URL: $($release.html_url)" -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user