Release script
This commit is contained in:
36
Script/CreateReleaseArchive.ps1
Normal file
36
Script/CreateReleaseArchive.ps1
Normal 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"
|
||||
Reference in New Issue
Block a user