@@ -42,6 +42,8 @@ $commitMessage = ""
42
42
$prTitle = " "
43
43
$newBranchName = " develop-nfbot/update-dependencies/" + [guid ]::NewGuid().ToString()
44
44
$packageTargetVersion = $env: NBGV_NuGetPackageVersion
45
+ $packageName = " nanoframework.testframework"
46
+ $repoMainBranch = " main"
45
47
46
48
# working directory is agent temp directory
47
49
Write-Debug " Changing working directory to $env: Agent_TempDirectory "
@@ -57,10 +59,34 @@ git config --global user.name nfbot
57
59
git config -- global user.email nanoframework@outlook.com
58
60
git config -- global core.autocrlf true
59
61
60
- Write-Host " Checkout develop branch..."
61
- git checkout -- quiet develop | Out-Null
62
+ Write-Host " Checkout $repoMainBranch branch..."
63
+ git checkout -- quiet $repoMainBranch | Out-Null
62
64
63
- dotnet nuget add source https:// pkgs.dev.azure.com / nanoframework/ feed/ _packaging/ sandbox/ nuget/ v3/ index.json - n nano.azure.feed
65
+ # check if nuget package is already available from nuget.org
66
+ $nugetApiUrl = " https://api.nuget.org/v3-flatcontainer/$packageName /index.json"
67
+
68
+ function Get-LatestNugetVersion {
69
+ param (
70
+ [string ]$url
71
+ )
72
+ try {
73
+ $response = Invoke-RestMethod - Uri $url - Method Get
74
+ return $response.versions [-1 ]
75
+ }
76
+ catch {
77
+ throw " Error querying NuGet API: $_ "
78
+ }
79
+ }
80
+
81
+ $latestNugetVersion = Get-LatestNugetVersion - url $nugetApiUrl
82
+
83
+ while ($latestNugetVersion -ne $packageTargetVersion ) {
84
+ Write-Host " Latest version still not available from nuget.org feed. Waiting 5 minutes..."
85
+ Start-Sleep - Seconds 300
86
+ $latestNugetVersion = Get-LatestNugetVersion - url $nugetApiUrl
87
+ }
88
+
89
+ Write-Host " Version $latestNugetVersion available from nuget.org feed. Proceeding with update."
64
90
65
91
# ###################
66
92
# VS 2019 & 2022
@@ -75,6 +101,7 @@ AddGeneratePathProperty -NewVersion $packageTargetVersion -FilePath 'VisualStudi
75
101
dotnet remove VisualStudio.Extension- 2022 / VisualStudio.Extension- vs2022.csproj package nanoFramework.TestFramework
76
102
dotnet add VisualStudio.Extension- 2022 / VisualStudio.Extension- vs2022.csproj package nanoFramework.TestFramework -- version $packageTargetVersion
77
103
AddGeneratePathProperty - NewVersion $packageTargetVersion - FilePath ' VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj'
104
+ nuget restore - uselockfile
78
105
79
106
# ####################
80
107
@@ -133,10 +160,9 @@ if ($repoStatus -ne "")
133
160
git - c http.extraheader= " AUTHORIZATION: $auth " push -- set-upstream origin $newBranchName > $null
134
161
135
162
# start PR
136
- # we are hardcoding to 'develop' branch to have a fixed one
137
- # this is very important for tags (which don't have branch information)
163
+ # we are pointing to the $repoMainBranch
138
164
# considering that the base branch can be changed at the PR ther is no big deal about this
139
- $prRequestBody = @ {title = " $prTitle " ;body = " $commitMessage " ;head = " $newBranchName " ;base = " develop " } | ConvertTo-Json
165
+ $prRequestBody = @ {title = " $prTitle " ;body = " $commitMessage " ;head = " $newBranchName " ;base = " $repoMainBranch " } | ConvertTo-Json
140
166
$githubApiEndpoint = " https://api.github.com/repos/nanoframework/nf-Visual-Studio-extension/pulls"
141
167
[Net.ServicePointManager ]::SecurityProtocol = [Net.SecurityProtocolType ]::Tls12
142
168
0 commit comments