Skip to content

Commit 3c72a8b

Browse files
authored
Update LibNode to 26.1.2 and publish releases only for main CI runs (#520)
1 parent bf0caa4 commit 3c72a8b

3 files changed

Lines changed: 89 additions & 11 deletions

File tree

‎.ado/publish.yml‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ extends:
377377
pathtoPublish: $(Build.ArtifactStagingDirectory)
378378
artifactName: published-packages
379379
targetPath: $(Build.StagingDirectory)/pkg
380+
- output: pipelineArtifact
381+
artifactName: published-symbols
382+
targetPath: $(Build.StagingDirectory)/symbols
380383

381384
pool:
382385
name: Azure-Pipelines-1ESPT-ExDShared
@@ -493,19 +496,17 @@ extends:
493496
-Path "$(Build.SourcesDirectory)/out/bin/Release/NodeApi/aot/win-x64/publish/Microsoft.JavaScript.NodeApi.node.dll" `
494497
-NewName "Microsoft.JavaScript.NodeApi.node"
495498
496-
# Make symbols available through http://symweb.
497-
- task: PublishSymbols@2
498-
displayName: Publish symbols
499+
- task: CopyFiles@2
500+
displayName: Stage symbols
499501
inputs:
500-
IndexSources: false # PublishSymbols does not support GitHub sources
501-
SymbolsFolder: $(Build.SourcesDirectory)/out/bin/Release
502-
SearchPattern: |
502+
SourceFolder: $(Build.SourcesDirectory)/out/bin/Release
503+
Contents: |
503504
**/Microsoft.JavaScript.NodeApi.pdb
504505
**/win-x64/publish/Microsoft.JavaScript.NodeApi.node.pdb
505506
**/Microsoft.JavaScript.NodeApi.DotNetHost.pdb
506507
**/Microsoft.JavaScript.NodeApi.Generator.pdb
507-
SymbolServerType: TeamServices
508-
UseNetCoreClientTool: true
508+
TargetFolder: $(Build.StagingDirectory)/symbols
509+
flattenFolders: false
509510

510511
# Do not build or publish assemblies to avoid overriding signed binaries.
511512
- script: dotnet pack --configuration Release --no-build -p:NoPublish=true

‎.ado/release.yml‎

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Licensed under the MIT License.
33
#
44
# The Release pipeline to publish NPM and NuGet packages
5-
# to public ADO feeds and, through ESRP Release, to npmjs.com and NuGet.org.
5+
# to public ADO feeds and, through ESRP Release, to npmjs.com and NuGet.org,
6+
# and symbols to the Microsoft symbol server.
67
#
78

89
# Runs only when microsoft.node-api-dotnet.ci completes on main (see resources
@@ -52,9 +53,85 @@ extends:
5253
networkIsolationMode: Enforce
5354

5455
stages:
56+
- stage: gate
57+
displayName: Evaluate release
58+
jobs:
59+
- job: evaluate
60+
displayName: Check that the CI run is from main
61+
steps:
62+
- checkout: none
63+
64+
# Missing or unresolved CI branches fail closed. The Release branch is logged
65+
# only: any Release branch may publish artifacts already built by main CI.
66+
- pwsh: |
67+
$branch = $env:CI_SOURCE_BRANCH
68+
$ciRunName = $env:CI_RUN_NAME
69+
$stamp = $env:BUILD_BUILDNUMBER
70+
Write-Host "CI run: $ciRunName (ID: $env:CI_RUN_ID)"
71+
Write-Host "CI branch: $branch"
72+
Write-Host "Release branch: $env:RELEASE_SOURCE_BRANCH (informational only)"
73+
if ($branch -ceq 'refs/heads/main') {
74+
$shouldRelease = 'True'
75+
$buildNumber = "Release - $ciRunName - $stamp"
76+
Write-Host "Releasing artifacts from main CI."
77+
} else {
78+
$shouldRelease = 'False'
79+
$buildNumber = "Skipped - $ciRunName ($($branch -replace '^refs/heads/', '')) - $stamp"
80+
Write-Host "Skipping: only CI runs of main are released; this one is from '$branch'. Nothing is published."
81+
}
82+
# Build numbers can't contain " ' / : < > \ | ? @ *, exceed 255 characters, or end with '.'.
83+
$buildNumber = $buildNumber -replace '["''/:<>\\|?@*]', '_'
84+
$buildNumber = $buildNumber.Substring(0, [Math]::Min(255, $buildNumber.Length)).TrimEnd('.')
85+
Write-Host "##vso[build.updatebuildnumber]$buildNumber"
86+
Write-Host "##vso[task.setvariable variable=shouldRelease;isOutput=true]$shouldRelease"
87+
name: gate
88+
displayName: Decide whether to release
89+
env:
90+
CI_SOURCE_BRANCH: $(resources.pipeline.microsoft_node-api-dotnet_ci.sourceBranch)
91+
CI_RUN_NAME: $(resources.pipeline.microsoft_node-api-dotnet_ci.runName)
92+
CI_RUN_ID: $(resources.pipeline.microsoft_node-api-dotnet_ci.runID)
93+
RELEASE_SOURCE_BRANCH: $(Build.SourceBranch)
94+
BUILD_BUILDNUMBER: $(Build.BuildNumber)
95+
96+
- pwsh: Write-Host 'Releasing'
97+
displayName: RELEASING - the CI run is from main
98+
condition: eq(variables['gate.shouldRelease'], 'True')
99+
100+
- pwsh: Write-Host 'Skipping'
101+
displayName: SKIPPED - the CI run is not from main, nothing is published
102+
condition: eq(variables['gate.shouldRelease'], 'False')
103+
55104
- stage: main_release
56-
displayName: Publish packages
105+
displayName: Publish packages and symbols
106+
dependsOn: gate
107+
condition: and(succeeded(), eq(dependencies.gate.outputs['evaluate.gate.shouldRelease'], 'True'))
57108
jobs:
109+
- job: publish_symbols
110+
displayName: Publish symbols
111+
timeoutInMinutes: 30
112+
templateContext:
113+
type: releaseJob
114+
isProduction: true
115+
inputs:
116+
- input: pipelineArtifact
117+
pipeline: microsoft_node-api-dotnet_ci
118+
artifactName: published-symbols
119+
targetPath: $(Pipeline.Workspace)/symbols
120+
121+
steps:
122+
- pwsh: Get-ChildItem -LiteralPath '$(Pipeline.Workspace)/symbols' -Recurse -Filter *.pdb | ForEach-Object FullName
123+
displayName: List symbols to publish
124+
125+
# Make symbols available through http://symweb.
126+
- task: PublishSymbols@2
127+
displayName: Publish symbols
128+
inputs:
129+
IndexSources: false # PublishSymbols does not support GitHub sources
130+
SymbolsFolder: $(Pipeline.Workspace)/symbols
131+
SearchPattern: '**/*.pdb'
132+
SymbolServerType: TeamServices
133+
UseNetCoreClientTool: true
134+
58135
- job: nuget_ms_react_native_public_job
59136
displayName: NuGet to ADO ms/react-native-public feed
60137
templateContext:

‎Directory.Packages.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
88
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" /><!-- 4.1.0 is compatible with .NET Standard -->
99
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
10-
<PackageVersion Include="Microsoft.JavaScript.LibNode" Version="26.0.18" />
10+
<PackageVersion Include="Microsoft.JavaScript.LibNode" Version="26.1.2" />
1111
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
1212
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
1313
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.10.91" />

0 commit comments

Comments
 (0)