mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:26:31 +00:00
fix for google drive upload script to handle full installer as well
This commit is contained in:
+18
-11
@@ -18,11 +18,19 @@ function Write-ErrorMsg($text) {
|
|||||||
Write-Host "[ERROR] $text" -ForegroundColor Red
|
Write-Host "[ERROR] $text" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-BuildNumber($filename) {
|
function Get-SortableBuildKey($filename) {
|
||||||
if ($filename -match "\.(\d+)\.(zip|exe)$") {
|
# This regex is specifically for the AzaionSuite filenames
|
||||||
return [int]$matches[1]
|
# 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"
|
Write-Header "Starting cleanup of older Full and Iterative installers on Google Drive"
|
||||||
@@ -48,16 +56,16 @@ $allFiles | ForEach-Object { Write-Host " $_" }
|
|||||||
# --- Full Installers ---
|
# --- Full Installers ---
|
||||||
Write-Header 'Checking for old Full installers (AzaionSuite.Full.*.zip)'
|
Write-Header 'Checking for old Full installers (AzaionSuite.Full.*.zip)'
|
||||||
$fullFiles = $allFiles | Where-Object { $_ -like "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) {
|
if ($fullFiles.Count -eq 0) {
|
||||||
Write-WarningMsg "No Full installer files found."
|
Write-WarningMsg "No Full installer files found."
|
||||||
} else {
|
} else {
|
||||||
Write-Info "Matching Full installer files:"
|
Write-Info "Matching Full installer files (sorted by date/build):"
|
||||||
$fullFiles | ForEach-Object { Write-Host " $_" }
|
$fullFiles | ForEach-Object { Write-Host " $_" }
|
||||||
|
|
||||||
if ($fullFiles.Count -le 5) {
|
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 {
|
} else {
|
||||||
$fullToDelete = $fullFiles | Select-Object -Skip 5
|
$fullToDelete = $fullFiles | Select-Object -Skip 5
|
||||||
Write-WarningMsg "Full installers to delete:"
|
Write-WarningMsg "Full installers to delete:"
|
||||||
@@ -77,16 +85,16 @@ if ($fullFiles.Count -eq 0) {
|
|||||||
# --- Iterative Installers ---
|
# --- Iterative Installers ---
|
||||||
Write-Header 'Checking for old Iterative installers (AzaionSuite.Iterative.*.exe)'
|
Write-Header 'Checking for old Iterative installers (AzaionSuite.Iterative.*.exe)'
|
||||||
$iterativeFiles = $allFiles | Where-Object { $_ -like "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) {
|
if ($iterativeFiles.Count -eq 0) {
|
||||||
Write-WarningMsg "No Iterative installer files found."
|
Write-WarningMsg "No Iterative installer files found."
|
||||||
} else {
|
} else {
|
||||||
Write-Info "Matching Iterative installer files:"
|
Write-Info "Matching Iterative installer files (sorted by date/build):"
|
||||||
$iterativeFiles | ForEach-Object { Write-Host " $_" }
|
$iterativeFiles | ForEach-Object { Write-Host " $_" }
|
||||||
|
|
||||||
if ($iterativeFiles.Count -le 5) {
|
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 {
|
} else {
|
||||||
$iterativeToDelete = $iterativeFiles | Select-Object -Skip 5
|
$iterativeToDelete = $iterativeFiles | Select-Object -Skip 5
|
||||||
Write-WarningMsg "Iterative installers to delete:"
|
Write-WarningMsg "Iterative installers to delete:"
|
||||||
@@ -104,4 +112,3 @@ if ($iterativeFiles.Count -eq 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Header "Cleanup script completed"
|
Write-Header "Cleanup script completed"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user