-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_release_status.ps1
More file actions
185 lines (167 loc) · 6.69 KB
/
Copy pathcheck_release_status.ps1
File metadata and controls
185 lines (167 loc) · 6.69 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# check_release_status.ps1
# Report current release readiness status
# Usage: .\check_release_status.ps1
Write-Host "=" * 70 -ForegroundColor Cyan
Write-Host "Release Status Check" -ForegroundColor Cyan
Write-Host "=" * 70 -ForegroundColor Cyan
Write-Host ""
$allChecksPassed = $true
# 1. Check current version
Write-Host "Version Information:" -ForegroundColor Yellow
try {
$jsFile = Get-Content "js/viewer-advanced.js" -Raw -ErrorAction Stop
$versionMatch = [regex]::Match($jsFile, "const VIEWER_VERSION = '([^']+)';")
if ($versionMatch.Success) {
$currentVersion = $versionMatch.Groups[1].Value
Write-Host " Current Version: $currentVersion" -ForegroundColor Green
} else {
Write-Host " ERROR: Could not find VIEWER_VERSION in js/viewer-advanced.js" -ForegroundColor Red
$allChecksPassed = $false
}
} catch {
Write-Host " ERROR: Could not read js/viewer-advanced.js" -ForegroundColor Red
Write-Host " $($_.Exception.Message)" -ForegroundColor DarkGray
$allChecksPassed = $false
}
Write-Host ""
# 2. Check required files exist
Write-Host "Required Files:" -ForegroundColor Yellow
$requiredFiles = @(
@{Path="interactive_viewer_advanced.html"; Name="Main HTML viewer"},
@{Path="js/viewer-advanced.js"; Name="Main JavaScript"},
@{Path="css/viewer-advanced.css"; Name="Main stylesheet"},
@{Path="generated/regions/regions_manifest.json.gz"; Name="Regions manifest"}
)
foreach ($file in $requiredFiles) {
if (Test-Path $file.Path) {
$size = (Get-Item $file.Path).Length
$sizeKB = [math]::Round($size / 1KB, 1)
Write-Host " [OK] $($file.Name): $sizeKB KB" -ForegroundColor Green
} else {
Write-Host " [MISSING] $($file.Name): $($file.Path)" -ForegroundColor Red
$allChecksPassed = $false
}
}
Write-Host ""
# 3. Count deployable files
Write-Host "Deployable Files:" -ForegroundColor Yellow
try {
$jsFiles = (Get-ChildItem "js/*.js" -ErrorAction Stop).Count
Write-Host " JavaScript files: $jsFiles" -ForegroundColor Cyan
} catch {
Write-Host " JavaScript files: ERROR - js/ directory not found" -ForegroundColor Red
$allChecksPassed = $false
}
try {
$cssFiles = (Get-ChildItem "css/*.css" -ErrorAction Stop).Count
Write-Host " CSS files: $cssFiles" -ForegroundColor Cyan
} catch {
Write-Host " CSS files: ERROR - css/ directory not found" -ForegroundColor Red
$allChecksPassed = $false
}
try {
$regionFiles = (Get-ChildItem "generated/regions/*.json.gz" -Exclude "*manifest*", "*adjacency*" -ErrorAction Stop).Count
Write-Host " Region data files: $regionFiles" -ForegroundColor Cyan
} catch {
Write-Host " Region data files: ERROR - generated/regions/ directory not found" -ForegroundColor Red
$allChecksPassed = $false
}
try {
$manifestFiles = (Get-ChildItem "generated/regions/*manifest*.json.gz" -ErrorAction Stop).Count
Write-Host " Manifest files: $manifestFiles" -ForegroundColor Cyan
} catch {
Write-Host " Manifest files: ERROR" -ForegroundColor Red
$allChecksPassed = $false
}
Write-Host ""
# 4. Check deployment configuration
Write-Host "Deployment Configuration:" -ForegroundColor Yellow
if (Test-Path "deploy-config.ps1") {
Write-Host " [OK] deploy-config.ps1 exists" -ForegroundColor Green
# Try to load it (but don't fail if it has errors - just warn)
try {
$null = . .\deploy-config.ps1 2>&1
if ($env:REMOTE_HOST -and $env:REMOTE_USER -and $env:REMOTE_PATH) {
Write-Host " [OK] Configuration loaded: $env:REMOTE_USER@$env:REMOTE_HOST:$env:REMOTE_PATH" -ForegroundColor Green
} else {
Write-Host " [WARN] Configuration file exists but may not be fully configured" -ForegroundColor Yellow
}
} catch {
Write-Host " [WARN] Could not load deploy-config.ps1: $($_.Exception.Message)" -ForegroundColor Yellow
}
} else {
Write-Host " [MISSING] deploy-config.ps1 not found" -ForegroundColor Red
Write-Host " Copy from deploy-config.example.ps1 and configure" -ForegroundColor DarkGray
$allChecksPassed = $false
}
Write-Host ""
# 5. Check Python environment
Write-Host "Python Environment:" -ForegroundColor Yellow
try {
$pythonVersion = python --version 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " [OK] Python: $pythonVersion" -ForegroundColor Green
# Check if bump_version.py exists
if (Test-Path "bump_version.py") {
Write-Host " [OK] bump_version.py available" -ForegroundColor Green
} else {
Write-Host " [MISSING] bump_version.py not found" -ForegroundColor Red
$allChecksPassed = $false
}
} else {
Write-Host " [ERROR] Python not found or not in PATH" -ForegroundColor Red
$allChecksPassed = $false
}
} catch {
Write-Host " [ERROR] Could not check Python: $($_.Exception.Message)" -ForegroundColor Red
$allChecksPassed = $false
}
Write-Host ""
# 6. Check SCP availability
Write-Host "Deployment Tools:" -ForegroundColor Yellow
try {
$null = Get-Command scp -ErrorAction Stop
Write-Host " [OK] SCP (OpenSSH client) available" -ForegroundColor Green
} catch {
Write-Host " [MISSING] SCP not found - install OpenSSH Client" -ForegroundColor Red
$allChecksPassed = $false
}
if (Test-Path "deploy.ps1") {
Write-Host " [OK] deploy.ps1 available" -ForegroundColor Green
} else {
Write-Host " [MISSING] deploy.ps1 not found" -ForegroundColor Red
$allChecksPassed = $false
}
Write-Host ""
# 7. Git status (informational)
Write-Host "Git Status:" -ForegroundColor Yellow
try {
$gitStatus = git status --short 2>&1
if ($LASTEXITCODE -eq 0) {
if ($gitStatus) {
Write-Host " [INFO] Uncommitted changes detected:" -ForegroundColor Yellow
$gitStatus | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
} else {
Write-Host " [OK] Working directory clean" -ForegroundColor Green
}
} else {
Write-Host " [INFO] Not a git repository or git not available" -ForegroundColor DarkGray
}
} catch {
Write-Host " [INFO] Could not check git status" -ForegroundColor DarkGray
}
Write-Host ""
# Summary
Write-Host "=" * 70 -ForegroundColor Cyan
if ($allChecksPassed) {
Write-Host "Status: READY FOR RELEASE" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host " 1. Run: .\release.ps1 -VersionType patch" -ForegroundColor Yellow
Write-Host " 2. Review preview output" -ForegroundColor Yellow
Write-Host " 3. Confirm deployment" -ForegroundColor Yellow
} else {
Write-Host "Status: NOT READY - Fix errors above" -ForegroundColor Red
exit 1
}
Write-Host "=" * 70 -ForegroundColor Cyan