37 lines
1.3 KiB
PowerShell
37 lines
1.3 KiB
PowerShell
# 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"
|