feat: download release only when needed (#1751)

* feat: download release only when needed in build.sh

* fix(build.sh): get latest tag time locally

* feat: download release only when needed in Build.ps1

* fix(build.sh): fix gt to ge
This commit is contained in:
xsy420
2025-03-28 10:23:27 +08:00
committed by GitHub
parent b6000d5bbc
commit ae9787d716
2 changed files with 22 additions and 2 deletions

View File

@@ -89,6 +89,20 @@ function Main {
Write-Host "Building for $Version..."
Build-FromSource $Version
} else {
$latestTag = git tag --sort=-creatordate | Select-Object -First 1
$latestTagTime = [int](git log -1 $latestTag --format=%at 2>&1 | Where-Object { $_ -match '^\d+$' })
$currentBuildTime = if ($buildFiles = Get-ChildItem -Path "build/avante_html2md*" -ErrorAction SilentlyContinue) {
[long](($buildFiles | ForEach-Object { $_.LastWriteTime } |
Measure-Object -Maximum).Maximum.Subtract([datetime]'1970-01-01').TotalSeconds)
} else {
$latestTagTime
}
if ($latestTagTime -lt $currentBuildTime) {
Write-Host "Local build is up to date. No download needed."
return
}
Write-Host "Downloading for $Version..."
Download-Prebuilt $Version
}