55 lines
1.7 KiB
PowerShell
55 lines
1.7 KiB
PowerShell
# Simple Release Packaging Script
|
|
param(
|
|
[string]$Version = "2.1.0"
|
|
)
|
|
|
|
$PACKAGE_NAME = "ResourceMonitorService-v$Version-$(Get-Date -Format 'yyyyMMdd-HHmm')"
|
|
$TEMP_PATH = ".\temp-release"
|
|
$OUTPUT_PATH = ".\release-packages"
|
|
|
|
Write-Host "Creating release package: $PACKAGE_NAME" -ForegroundColor Green
|
|
|
|
# Clean up
|
|
if (Test-Path $TEMP_PATH) { Remove-Item $TEMP_PATH -Recurse -Force }
|
|
if (-not (Test-Path $OUTPUT_PATH)) { New-Item -ItemType Directory -Path $OUTPUT_PATH -Force | Out-Null }
|
|
New-Item -ItemType Directory -Path $TEMP_PATH -Force | Out-Null
|
|
|
|
# Build release
|
|
Write-Host "Building release..." -ForegroundColor Yellow
|
|
dotnet publish --configuration Release --output $TEMP_PATH --verbosity minimal
|
|
|
|
# Copy additional files
|
|
Start-Sleep -Seconds 2
|
|
Copy-Item "install-service.ps1" $TEMP_PATH
|
|
Copy-Item "start-service.bat" $TEMP_PATH
|
|
Copy-Item "appsettings.json" $TEMP_PATH
|
|
Copy-Item "appsettings.Production.json" $TEMP_PATH -ErrorAction SilentlyContinue
|
|
Copy-Item "README.md" $TEMP_PATH -ErrorAction SilentlyContinue
|
|
|
|
# Create deployment readme
|
|
@"
|
|
# ResourceMonitorService v$Version Deployment
|
|
|
|
## Installation
|
|
1. Extract ZIP to temporary folder
|
|
2. Run PowerShell as Administrator
|
|
3. Execute: .\install-service.ps1
|
|
|
|
## Access
|
|
- Web Dashboard: http://localhost:24142
|
|
- API Health: http://localhost:24142/api/health
|
|
|
|
Generated: $(Get-Date)
|
|
"@ | Out-File "$TEMP_PATH\DEPLOYMENT.txt" -Encoding UTF8
|
|
|
|
# Create ZIP
|
|
Start-Sleep -Seconds 2
|
|
$zipPath = "$OUTPUT_PATH\$PACKAGE_NAME.zip"
|
|
Compress-Archive -Path "$TEMP_PATH\*" -DestinationPath $zipPath -Force
|
|
|
|
# Clean up
|
|
Remove-Item $TEMP_PATH -Recurse -Force
|
|
|
|
$size = [math]::Round((Get-Item $zipPath).Length / 1MB, 2)
|
|
Write-Host "Package created: $zipPath ($size MB)" -ForegroundColor Green
|