File size: 1,272 Bytes
10ff0f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Build a WordPress-ready zip for Synderesis Customer Agent.
# Run from anywhere:
#   powershell -File customer-agent/integrations/wordpress/scripts/build-zip.ps1

$ErrorActionPreference = "Stop"
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$pluginDir = Resolve-Path (Join-Path $here "..\synderesis-customer-agent")
$outDir = Resolve-Path (Join-Path $here "..")
$versionFile = Join-Path $pluginDir "synderesis-customer-agent.php"
$version = "1.4.0"
if (Test-Path $versionFile) {
  $text = Get-Content $versionFile -Raw
  if ($text -match "Version:\s*([0-9.]+)") { $version = $Matches[1] }
}
$zipName = "synderesis-customer-agent-$version.zip"
$zipPath = Join-Path $outDir $zipName
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }

# Zip must contain a single top-level folder: synderesis-customer-agent/
$staging = Join-Path $env:TEMP ("synderesis-ca-zip-" + [guid]::NewGuid().ToString("n"))
New-Item -ItemType Directory -Path $staging | Out-Null
try {
  Copy-Item -Recurse -Force $pluginDir (Join-Path $staging "synderesis-customer-agent")
  Compress-Archive -Path (Join-Path $staging "synderesis-customer-agent") -DestinationPath $zipPath
  Write-Host "Wrote $zipPath"
} finally {
  Remove-Item -Recurse -Force $staging -ErrorAction SilentlyContinue
}