Skip to content

Commit 653286e

Browse files
committed
Work CI-CD
- Update PS1 to update VS extension with new pattern. - Fix sign step to not use file list. ***NO_CI***
1 parent eb92160 commit 653286e

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

azure-pipelines.yml

-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ jobs:
225225
.\sign code azure-key-vault `
226226
"**/*.nupkg" `
227227
--base-directory "$(Build.ArtifactStagingDirectory)" `
228-
--file-list "$(Build.Repository.LocalPath)\config\filelist.txt" `
229228
--description "Test Framework" `
230229
--description-url "https://github.com/$env:Build_Repository_Name" `
231230
--azure-key-vault-tenant-id "$(SignTenantId)" `

azure-pipelines/update-dependents.ps1

+32-6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ $commitMessage = ""
4242
$prTitle = ""
4343
$newBranchName = "develop-nfbot/update-dependencies/" + [guid]::NewGuid().ToString()
4444
$packageTargetVersion = $env:NBGV_NuGetPackageVersion
45+
$packageName = "nanoframework.testframework"
46+
$repoMainBranch = "main"
4547

4648
# working directory is agent temp directory
4749
Write-Debug "Changing working directory to $env:Agent_TempDirectory"
@@ -57,10 +59,34 @@ git config --global user.name nfbot
5759
git config --global user.email nanoframework@outlook.com
5860
git config --global core.autocrlf true
5961

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
6264

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."
6490

6591
####################
6692
# VS 2019 & 2022
@@ -75,6 +101,7 @@ AddGeneratePathProperty -NewVersion $packageTargetVersion -FilePath 'VisualStudi
75101
dotnet remove VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.TestFramework
76102
dotnet add VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.TestFramework --version $packageTargetVersion
77103
AddGeneratePathProperty -NewVersion $packageTargetVersion -FilePath 'VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj'
104+
nuget restore -uselockfile
78105

79106
#####################
80107

@@ -133,10 +160,9 @@ if ($repoStatus -ne "")
133160
git -c http.extraheader="AUTHORIZATION: $auth" push --set-upstream origin $newBranchName > $null
134161

135162
# 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
138164
# 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
140166
$githubApiEndpoint = "https://api.github.com/repos/nanoframework/nf-Visual-Studio-extension/pulls"
141167
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
142168

0 commit comments

Comments
 (0)