From 3081645319793ffc43161417dc725f9c1979569b Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Wed, 19 Apr 2023 22:43:13 +0200 Subject: [PATCH] fixed new version implementation for pre-releases --- Winget-AutoUpdate/Winget-Upgrade.ps1 | 4 ++-- Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 | 4 ++-- Winget-AutoUpdate/functions/Update-WAU.ps1 | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index d8b015b..54d226b 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -92,9 +92,9 @@ if (Test-Network) { else { Write-ToLog "WAU AutoUpdate is Enabled." "Green" #Get Available Version - $WAUAvailableVersion = Get-WAUAvailableVersion + $Script:WAUAvailableVersion = Get-WAUAvailableVersion #Compare - if ([version]$WAUAvailableVersion -gt [version]$WAUCurrentVersion) { + if ([version]$WAUAvailableVersion.Replace("-", ".") -ne [version]$WAUCurrentVersion) { #If new version is available, update it Write-ToLog "WAU Available version: $WAUAvailableVersion" "Yellow" Update-WAU diff --git a/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 b/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 index 2a2e873..c2241ab 100644 --- a/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 +++ b/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1 @@ -19,7 +19,7 @@ function Get-WAUAvailableVersion { } - #Return version to windows format (1.0.0 or 1.0.0.0 for nightlies) - return (((Invoke-WebRequest $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")).Replace("-", ".") + #Return version + return ((Invoke-WebRequest $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "") } diff --git a/Winget-AutoUpdate/functions/Update-WAU.ps1 b/Winget-AutoUpdate/functions/Update-WAU.ps1 index 6ca47e7..36d3e21 100644 --- a/Winget-AutoUpdate/functions/Update-WAU.ps1 +++ b/Winget-AutoUpdate/functions/Update-WAU.ps1 @@ -41,9 +41,9 @@ function Update-WAU { Remove-Item -Path $location -Recurse -Force -ErrorAction SilentlyContinue #Set new version to registry - $WAUConfig | New-ItemProperty -Name DisplayVersion -Value $WAUAvailableVersion -Force - $WAUConfig | New-ItemProperty -Name VersionMajor -Value ([version]$WAUAvailableVersion).Major -Force - $WAUConfig | New-ItemProperty -Name VersionMinor -Value ([version]$WAUAvailableVersion).Minor -Force + $WAUConfig | New-ItemProperty -Name DisplayVersion -Value $($WAUAvailableVersion.Replace("-", ".")) -Force + $WAUConfig | New-ItemProperty -Name VersionMajor -Value ([version]$WAUAvailableVersion.Replace("-", ".")).Major -Force + $WAUConfig | New-ItemProperty -Name VersionMinor -Value ([version]$WAUAvailableVersion.Replace("-", ".")).Minor -Force #Set Post Update actions to 1 $WAUConfig | New-ItemProperty -Name WAU_PostUpdateActions -Value 1 -Force