wingetautoupdate/Winget-AutoUpdate/functions/Get-WAUAvailableVersion.ps1

23 lines
682 B
PowerShell
Raw Normal View History

# Function to get the latest WAU available version on Github
2023-09-15 14:38:54 +00:00
function Get-WAUAvailableVersion
{
# Get Github latest version
2023-09-15 14:38:54 +00:00
if ($WAUConfig.WAU_UpdatePrerelease -eq 1)
{
# Log
Write-ToLog -LogMsg 'WAU AutoUpdate Pre-release versions is Enabled' -LogColor 'Cyan'
# Get latest pre-release info
$WAUurl = 'https://api.github.com/repos/Romanitho/Winget-AutoUpdate/releases'
}
2023-09-15 14:38:54 +00:00
else
{
# Get latest stable info
$WAUurl = 'https://api.github.com/repos/Romanitho/Winget-AutoUpdate/releases/latest'
}
# Return version
return ((Invoke-WebRequest -Uri $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace('v', '')
2022-10-26 22:49:10 +00:00
}