Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version reports it is old (Target: main) #4206

Closed
wants to merge 21 commits into from
7 changes: 4 additions & 3 deletions publish-scripts/chocolatey/installps_template
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ $packageArgs = @{
Install-ChocolateyZipPackage @packageArgs

# only symlink for func.exe
$files = Get-ChildItem $toolsDir -include *.exe -recurse
$files = Get-ChildItem $toolsDir -filter *.exe -Recurse -File
foreach ($file in $files) {
if (!$file.Name.Equals("func.exe")) {
if (!$file.Name.Equals("func.exe") -or (!($file.DirectoryName -eq $toolsDir) -and $file.Name.Equals("func.exe"))) {
#generate an ignore file
New-Item "$file.ignore" -type file -force | Out-Null
$ignoreFilePath = Join-Path -Path $file.DirectoryName -ChildPath "$($file.Name).ignore"
New-Item -Path $ignoreFilePath -Type File -Force | Out-Null
}
}

Expand Down
28 changes: 25 additions & 3 deletions src/Azure.Functions.Cli/Helpers/VersionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public static async Task<bool> IsRunningAnOlderVersion()
releaseList.Add(new ReleaseSummary() { Release = jProperty.Name, ReleaseDetail = releaseDetail.ReleaseList.FirstOrDefault() });
}

var latestCoreToolsReleaseVersion = releaseList.FirstOrDefault(x => x.Release == data.Tags.V4Release.ReleaseVersion)?.CoreToolsReleaseNumber;
var latestCoreToolsReleaseZipFile = releaseList.FirstOrDefault(x => x.Release == data.Tags.V4Release.ReleaseVersion)?.CoreToolsReleaseZipfile;

if (!string.IsNullOrEmpty(latestCoreToolsReleaseVersion) &&
Constants.CliVersion != latestCoreToolsReleaseVersion)
if (!string.IsNullOrEmpty(latestCoreToolsReleaseZipFile) &&
!latestCoreToolsReleaseZipFile.Contains($"{Constants.CliVersion}.zip"))
{
return true;
}
Expand Down Expand Up @@ -184,6 +184,28 @@ public string CoreToolsReleaseNumber
}
}
public CoreToolsRelease ReleaseDetail { get; set; }
public string CoreToolsReleaseZipfile
{
get
{
var downloadLink = ReleaseDetail?.DownloadLink;
if (string.IsNullOrEmpty(ReleaseDetail?.DownloadLink))
{
return string.Empty;
}

Uri uri = new UriBuilder(ReleaseDetail?.DownloadLink).Uri;

if (uri.Segments.Length < 4)
{
return string.Empty;
}

return uri.Segments[3];

}
}

}

private class ReleaseDetail
Expand Down
Loading