Release script

This commit is contained in:
Andre Beging
2024-12-04 09:38:33 +01:00
parent 27e92ac552
commit a76a57062e
6 changed files with 67 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
# Setze das Arbeitsverzeichnis auf den Skript-Ordner
Set-Location -Path (Split-Path -Parent $MyInvocation.MyCommand.Definition)
# Relative Pfade definieren
$sourceConfigPath = "..\DefaultConfig"
$releasePath = "..\Server\release"
$serverExePath = "..\Server\release\Program\Server.exe"
# Ziel-ZIP-Datei basierend auf der Version der Server.exe
if (-Not (Test-Path -Path $serverExePath)) {
Write-Error "Die Datei $serverExePath wurde nicht gefunden."
exit 1
}
# Version der Server.exe auslesen
$fileVersionInfo = (Get-Item $serverExePath).VersionInfo
$zipFileName = "Release_$($fileVersionInfo.FileVersion).zip"
$zipFilePath = Join-Path $releasePath $zipFileName
# Sicherstellen, dass das Release-Verzeichnis existiert
if (-Not (Test-Path -Path $releasePath)) {
New-Item -ItemType Directory -Path $releasePath | Out-Null
}
# Dateien aus DefaultConfig ins Release-Verzeichnis kopieren
Copy-Item -Path $sourceConfigPath\* -Destination $releasePath -Recurse -Force
# Vorhandene ZIP-Datei mit demselben Namen löschen (falls vorhanden)
if (Test-Path -Path $zipFilePath) {
Remove-Item -Path $zipFilePath -Force
}
# Alle Dateien im Release-Verzeichnis zippen
Compress-Archive -Path "$releasePath\*" -DestinationPath $zipFilePath
Write-Host "ZIP-Archiv wurde erstellt: $zipFilePath"