Skip to content

Commit 53dadec

Browse files
committed
Work CI-CD
- Improve update dependencies PS1 to wait for nuget package to be available from nuget feed. - Update default branch of VS extension repo to be main. - Add missing license header. ***NO_CI***
1 parent b7ee568 commit 53dadec

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

azure-pipelines/update-dependents.ps1

+34-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) .NET Foundation and Contributors
2+
# See LICENSE file in the project root for full license information.
3+
14
"Updating dependents of nano-debugger" | Write-Host
25

36
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
@@ -14,12 +17,14 @@ $prTitle = ""
1417
$newBranchName = "develop-nfbot/update-dependencies/" + [guid]::NewGuid().ToString()
1518
$packageTargetVersion = gh release view --json tagName --jq .tagName
1619
$packageTargetVersion = $packageTargetVersion -replace "v"
20+
$packageName = "nanoframework.tools.debugger.net"
21+
$repoMainBranch = "main"
1722

1823
# working directory is agent temp directory
1924
Write-Debug "Changing working directory to $env:Agent_TempDirectory"
2025
Set-Location "$env:Agent_TempDirectory" | Out-Null
2126

22-
# clone repo and checkout develop branch
27+
# clone repo and checkout
2328
Write-Debug "Init and featch nf-Visual-Studio-extension repo"
2429

2530
####################
@@ -35,8 +40,34 @@ git config --global user.name nfbot
3540
git config --global user.email nanoframework@outlook.com
3641
git config --global core.autocrlf true
3742

38-
Write-Host "Checkout develop branch..."
39-
git checkout --quiet develop | Out-Null
43+
Write-Host "Checkout $repoMainBranch branch..."
44+
git checkout --quiet $repoMainBranch | Out-Null
45+
46+
# check if nuget package is already available from nuget.org
47+
$nugetApiUrl = "https://api.nuget.org/v3-flatcontainer/$packageName/index.json"
48+
49+
function Get-LatestNugetVersion {
50+
param (
51+
[string]$url
52+
)
53+
try {
54+
$response = Invoke-RestMethod -Uri $url -Method Get
55+
return $response.versions[-1]
56+
}
57+
catch {
58+
throw "Error querying NuGet API: $_"
59+
}
60+
}
61+
62+
$latestNugetVersion = Get-LatestNugetVersion -url $nugetApiUrl
63+
64+
while ($latestNugetVersion -ne $packageTargetVersion) {
65+
Write-Host "Latest version still not available from nuget.org feed. Waiting 5 minutes..."
66+
Start-Sleep -Seconds 300
67+
$latestNugetVersion = Get-LatestNugetVersion -url $nugetApiUrl
68+
}
69+
70+
Write-Host "Version $latestNugetVersion available from nuget.org feed. Proceeding with update."
4071

4172
dotnet restore
4273
dotnet remove VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj package nanoFramework.Tools.Debugger.Net

0 commit comments

Comments
 (0)