Files
gao-customer-h5/scripts/build-zip.ps1
T
2026-10-16 18:33:03 +08:00

21 lines
725 B
PowerShell

$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"