fix(install): use latest release instead of hardcoded version

- Download from /releases/latest/download/ URL
- Remove hardcoded version variable
- Simplify clone to use default branch

Related to host-uk/core#37

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-01 06:21:18 +00:00
parent 670fad9bbf
commit ec2e1c9865

View file

@ -27,7 +27,6 @@ if ($PSVersionTable.PSVersion.Major -lt 4) {
} }
$Repo = "host-uk/core" $Repo = "host-uk/core"
$Version = "main" # Build from main until stable Windows releases are available
$MinDiskSpaceMB = 100 # Minimum required disk space in MB $MinDiskSpaceMB = 100 # Minimum required disk space in MB
function Write-Info { Write-Host "[INFO] $args" -ForegroundColor Green } function Write-Info { Write-Host "[INFO] $args" -ForegroundColor Green }
@ -213,10 +212,10 @@ function Set-SecureDirectoryAcl {
# Download pre-built binary with integrity verification # Download pre-built binary with integrity verification
function Download-Binary { function Download-Binary {
$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "386" } $arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "386" }
$binaryUrl = "https://github.com/$Repo/releases/download/$Version/core-windows-$arch.exe" $binaryUrl = "https://github.com/$Repo/releases/latest/download/core-windows-$arch.exe"
$checksumUrl = "https://github.com/$Repo/releases/download/$Version/checksums.txt" $checksumUrl = "https://github.com/$Repo/releases/latest/download/checksums.txt"
Write-Info "Attempting to download pre-built binary (version $Version)..." Write-Info "Attempting to download pre-built binary..."
Write-Info "URL: $binaryUrl" Write-Info "URL: $binaryUrl"
# Track temp file for cleanup # Track temp file for cleanup
@ -340,20 +339,13 @@ function Build-FromSource {
$null = Set-SecureDirectoryAcl -Path $tmpdir -Required $null = Set-SecureDirectoryAcl -Path $tmpdir -Required
try { try {
Write-Info "Cloning $Repo (version $Version)..." Write-Info "Cloning $Repo..."
$cloneDir = Join-Path $tmpdir "Core" $cloneDir = Join-Path $tmpdir "Core"
# Clone specific tag for reproducibility # Clone default branch
git clone --depth 1 --branch $Version "https://github.com/$Repo.git" $cloneDir git clone --depth 1 "https://github.com/$Repo.git" $cloneDir
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Err "Failed to clone repository at version $Version" Write-Err "Failed to clone repository"
}
# Verify GPG signature on tag (if available, skip for branches)
if ($Version -match "^v\d") {
$null = Test-GitTagSignature -RepoPath $cloneDir -Tag $Version
} else {
Write-Warn "Building from branch '$Version' - GPG verification skipped (only applies to tags)"
} }
Write-Info "Building core CLI..." Write-Info "Building core CLI..."
@ -462,7 +454,7 @@ function Verify {
# Main # Main
function Main { function Main {
Write-Info "Installing Core CLI (version $Version)..." Write-Info "Installing Core CLI..."
# Check disk space before starting # Check disk space before starting
$null = Test-DiskSpace -Path $InstallDir $null = Test-DiskSpace -Path $InstallDir