Add deployment automation system with build/publish workflow and fix path resolution

This commit introduces a complete deployment automation system for Windows Server deployment:

New Features:
- Publish-And-Deploy.ps1: Interactive console for building locally and transferring to server
  * Supports auto-detection of transfer method (Windows Share or SSH)
  * Configurable via deploy-config.json
  * Integrated with Build-ROA2WEB.ps1 for consistent builds
- Check-And-Deploy.ps1: Server-side auto-deployment script
  * Monitors transfer directory for new packages
  * Automatically deploys when new version detected
  * Integrates with ROA2WEB-Console.ps1 for deployment
- Setup-AutoDeploy.ps1: Configures scheduled task for auto-deployment
- DEPLOYMENT_AUTOMATION.md: Complete documentation for automation workflow

Bug Fixes:
- Fix path resolution in Publish-And-Deploy.ps1: Added Resolve-FullPath function to correctly resolve ../deploy-package path
- Fix ROA2WEB-Console.ps1 exit codes: Properly return boolean values and exit codes in non-interactive mode
- Fix Build-ROA2WEB.ps1 script copying: Added debug output and force deletion to avoid caching issues

Enhancements:
- ROA2WEB-Console.ps1: Support for ROA2WEB_SOURCE environment variable for flexible source paths
- Build-ROA2WEB.ps1: Enhanced debug output for troubleshooting script copying issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-14 14:59:47 +02:00
parent 914ab0107e
commit 87859e5510
7 changed files with 2714 additions and 14 deletions

View File

@@ -658,6 +658,11 @@ function Copy-DeploymentScripts {
$scriptsDir = Join-Path $DestPath "scripts"
New-Item -ItemType Directory -Path $scriptsDir -Force | Out-Null
# Debug: Show paths
Write-Host " [DEBUG] ScriptsSourcePath: $ScriptsSourcePath" -ForegroundColor Magenta
Write-Host " [DEBUG] DestPath: $DestPath" -ForegroundColor Magenta
Write-Host " [DEBUG] ScriptsDir: $scriptsDir" -ForegroundColor Magenta
# Essential scripts for all deployments
$scripts = @(
"ROA2WEB-Console.ps1", # Unified deployment & management console
@@ -684,7 +689,25 @@ function Copy-DeploymentScripts {
foreach ($script in $scripts) {
$scriptPath = Join-Path $ScriptsSourcePath $script
if (Test-Path $scriptPath) {
$destScript = Join-Path $scriptsDir $script
# Debug: Show file info
$sourceSize = (Get-Item $scriptPath).Length
Write-Host " [DEBUG] Copying $script (size: $sourceSize bytes)" -ForegroundColor Magenta
# Force delete destination first to avoid caching issues
if (Test-Path $destScript) {
$oldSize = (Get-Item $destScript).Length
Write-Host " [DEBUG] Deleting old $script (was: $oldSize bytes)" -ForegroundColor Magenta
Remove-Item -Path $destScript -Force
}
Copy-Item -Path $scriptPath -Destination $scriptsDir -Force
# Debug: Verify copy
$newSize = (Get-Item $destScript).Length
Write-Host " [DEBUG] Copied $script (new size: $newSize bytes)" -ForegroundColor Magenta
$copiedCount++
} else {
Write-Warning "Script not found: $script"