Spaces:
Running
Running
| # 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 | |
| } | |