mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:36:29 +00:00
Merge remote-tracking branch 'origin/stage' into stage
This commit is contained in:
+18
-11
@@ -18,11 +18,19 @@ function Write-ErrorMsg($text) {
|
||||
Write-Host "[ERROR] $text" -ForegroundColor Red
|
||||
}
|
||||
|
||||
function Get-BuildNumber($filename) {
|
||||
if ($filename -match "\.(\d+)\.(zip|exe)$") {
|
||||
return [int]$matches[1]
|
||||
function Get-SortableBuildKey($filename) {
|
||||
# This regex is specifically for the AzaionSuite filenames
|
||||
# It captures the four-part build number (year.month.day.build)
|
||||
if ($filename -match 'AzaionSuite\.(?:Full|Iterative)\.Stage\.(\d{4})\.(\d+)\.(\d+)\.(\d+)\.(zip|exe)$') {
|
||||
# Create a combined key that can be sorted chronologically
|
||||
# Example: '202507030634'
|
||||
$year = [int]$matches[1]
|
||||
$month = [int]$matches[2]
|
||||
$day = [int]$matches[3]
|
||||
$buildNumber = [int]$matches[4]
|
||||
return "$year-$month-$day-$buildNumber"
|
||||
}
|
||||
return 0
|
||||
return "0000-00-00-0000"
|
||||
}
|
||||
|
||||
Write-Header "Starting cleanup of older Full and Iterative installers on Google Drive"
|
||||
@@ -48,16 +56,16 @@ $allFiles | ForEach-Object { Write-Host " $_" }
|
||||
# --- Full Installers ---
|
||||
Write-Header 'Checking for old Full installers (AzaionSuite.Full.*.zip)'
|
||||
$fullFiles = $allFiles | Where-Object { $_ -like "AzaionSuite.Full.*.zip" } |
|
||||
Sort-Object { Get-BuildNumber $_ } -Descending
|
||||
Sort-Object { Get-SortableBuildKey $_ } -Descending
|
||||
|
||||
if ($fullFiles.Count -eq 0) {
|
||||
Write-WarningMsg "No Full installer files found."
|
||||
} else {
|
||||
Write-Info "Matching Full installer files:"
|
||||
Write-Info "Matching Full installer files (sorted by date/build):"
|
||||
$fullFiles | ForEach-Object { Write-Host " $_" }
|
||||
|
||||
if ($fullFiles.Count -le 5) {
|
||||
Write-Info "5 or fewer Full installers found — nothing to delete."
|
||||
Write-Info "5 or fewer Full installers found — nothing to delete."
|
||||
} else {
|
||||
$fullToDelete = $fullFiles | Select-Object -Skip 5
|
||||
Write-WarningMsg "Full installers to delete:"
|
||||
@@ -77,16 +85,16 @@ if ($fullFiles.Count -eq 0) {
|
||||
# --- Iterative Installers ---
|
||||
Write-Header 'Checking for old Iterative installers (AzaionSuite.Iterative.*.exe)'
|
||||
$iterativeFiles = $allFiles | Where-Object { $_ -like "AzaionSuite.Iterative.*.exe" } |
|
||||
Sort-Object { Get-BuildNumber $_ } -Descending
|
||||
Sort-Object { Get-SortableBuildKey $_ } -Descending
|
||||
|
||||
if ($iterativeFiles.Count -eq 0) {
|
||||
Write-WarningMsg "No Iterative installer files found."
|
||||
} else {
|
||||
Write-Info "Matching Iterative installer files:"
|
||||
Write-Info "Matching Iterative installer files (sorted by date/build):"
|
||||
$iterativeFiles | ForEach-Object { Write-Host " $_" }
|
||||
|
||||
if ($iterativeFiles.Count -le 5) {
|
||||
Write-Info "5 or fewer Iterative installers found — nothing to delete."
|
||||
Write-Info "5 or fewer Iterative installers found — nothing to delete."
|
||||
} else {
|
||||
$iterativeToDelete = $iterativeFiles | Select-Object -Skip 5
|
||||
Write-WarningMsg "Iterative installers to delete:"
|
||||
@@ -104,4 +112,3 @@ if ($iterativeFiles.Count -eq 0) {
|
||||
}
|
||||
|
||||
Write-Header "Cleanup script completed"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user