$ErrorActionPreference = "Stop" $projectRoot = Split-Path -Parent $PSScriptRoot $releaseDirectory = Join-Path $projectRoot "release" $distPath = Join-Path $projectRoot "dist" New-Item -ItemType Directory -Force -Path $releaseDirectory | Out-Null $timestamp = Get-Date -Format "yyyyMMdd-HHmmss" $archiveBaseName = "gao-customer-h5-$timestamp" $archivePath = Join-Path $releaseDirectory "$archiveBaseName.zip" $collisionIndex = 1 while (Test-Path -LiteralPath $archivePath) { $archivePath = Join-Path $releaseDirectory "$archiveBaseName-$collisionIndex.zip" $collisionIndex++ } Compress-Archive -Path (Join-Path $distPath "*") -DestinationPath $archivePath -ErrorAction Stop Write-Output "Created archive: $archivePath"