Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ extends:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: published-packages
targetPath: $(Build.StagingDirectory)/pkg
- output: pipelineArtifact
artifactName: published-symbols
targetPath: $(Build.StagingDirectory)/symbols

pool:
name: Azure-Pipelines-1ESPT-ExDShared
Expand Down Expand Up @@ -493,19 +496,17 @@ extends:
-Path "$(Build.SourcesDirectory)/out/bin/Release/NodeApi/aot/win-x64/publish/Microsoft.JavaScript.NodeApi.node.dll" `
-NewName "Microsoft.JavaScript.NodeApi.node"

# Make symbols available through http://symweb.
- task: PublishSymbols@2
displayName: Publish symbols
- task: CopyFiles@2
displayName: Stage symbols
inputs:
IndexSources: false # PublishSymbols does not support GitHub sources
SymbolsFolder: $(Build.SourcesDirectory)/out/bin/Release
SearchPattern: |
SourceFolder: $(Build.SourcesDirectory)/out/bin/Release
Contents: |
**/Microsoft.JavaScript.NodeApi.pdb
**/win-x64/publish/Microsoft.JavaScript.NodeApi.node.pdb
**/Microsoft.JavaScript.NodeApi.DotNetHost.pdb
**/Microsoft.JavaScript.NodeApi.Generator.pdb
SymbolServerType: TeamServices
UseNetCoreClientTool: true
TargetFolder: $(Build.StagingDirectory)/symbols
flattenFolders: false

# Do not build or publish assemblies to avoid overriding signed binaries.
- script: dotnet pack --configuration Release --no-build -p:NoPublish=true
Expand Down
81 changes: 79 additions & 2 deletions .ado/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Licensed under the MIT License.
#
# The Release pipeline to publish NPM and NuGet packages
# to public ADO feeds and, through ESRP Release, to npmjs.com and NuGet.org.
# to public ADO feeds and, through ESRP Release, to npmjs.com and NuGet.org,
# and symbols to the Microsoft symbol server.
#

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

stages:
- stage: gate
displayName: Evaluate release
jobs:
- job: evaluate
displayName: Check that the CI run is from main
steps:
- checkout: none

# Missing or unresolved CI branches fail closed. The Release branch is logged
# only: any Release branch may publish artifacts already built by main CI.
- pwsh: |
$branch = $env:CI_SOURCE_BRANCH
$ciRunName = $env:CI_RUN_NAME
$stamp = $env:BUILD_BUILDNUMBER
Write-Host "CI run: $ciRunName (ID: $env:CI_RUN_ID)"
Write-Host "CI branch: $branch"
Write-Host "Release branch: $env:RELEASE_SOURCE_BRANCH (informational only)"
if ($branch -ceq 'refs/heads/main') {
$shouldRelease = 'True'
$buildNumber = "Release - $ciRunName - $stamp"
Write-Host "Releasing artifacts from main CI."
} else {
$shouldRelease = 'False'
$buildNumber = "Skipped - $ciRunName ($($branch -replace '^refs/heads/', '')) - $stamp"
Write-Host "Skipping: only CI runs of main are released; this one is from '$branch'. Nothing is published."
}
# Build numbers can't contain " ' / : < > \ | ? @ *, exceed 255 characters, or end with '.'.
$buildNumber = $buildNumber -replace '["''/:<>\\|?@*]', '_'
$buildNumber = $buildNumber.Substring(0, [Math]::Min(255, $buildNumber.Length)).TrimEnd('.')
Write-Host "##vso[build.updatebuildnumber]$buildNumber"
Write-Host "##vso[task.setvariable variable=shouldRelease;isOutput=true]$shouldRelease"
name: gate
displayName: Decide whether to release
env:
CI_SOURCE_BRANCH: $(resources.pipeline.microsoft_node-api-dotnet_ci.sourceBranch)
CI_RUN_NAME: $(resources.pipeline.microsoft_node-api-dotnet_ci.runName)
CI_RUN_ID: $(resources.pipeline.microsoft_node-api-dotnet_ci.runID)
RELEASE_SOURCE_BRANCH: $(Build.SourceBranch)
BUILD_BUILDNUMBER: $(Build.BuildNumber)

- pwsh: Write-Host 'Releasing'
displayName: RELEASING - the CI run is from main
condition: eq(variables['gate.shouldRelease'], 'True')

- pwsh: Write-Host 'Skipping'
displayName: SKIPPED - the CI run is not from main, nothing is published
condition: eq(variables['gate.shouldRelease'], 'False')

- stage: main_release
displayName: Publish packages
displayName: Publish packages and symbols
dependsOn: gate
condition: and(succeeded(), eq(dependencies.gate.outputs['evaluate.gate.shouldRelease'], 'True'))
jobs:
- job: publish_symbols
displayName: Publish symbols
timeoutInMinutes: 30
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
pipeline: microsoft_node-api-dotnet_ci
artifactName: published-symbols
targetPath: $(Pipeline.Workspace)/symbols

steps:
- pwsh: Get-ChildItem -LiteralPath '$(Pipeline.Workspace)/symbols' -Recurse -Filter *.pdb | ForEach-Object FullName
displayName: List symbols to publish

# Make symbols available through http://symweb.
- task: PublishSymbols@2
displayName: Publish symbols
inputs:
IndexSources: false # PublishSymbols does not support GitHub sources
SymbolsFolder: $(Pipeline.Workspace)/symbols
SearchPattern: '**/*.pdb'
SymbolServerType: TeamServices
UseNetCoreClientTool: true

- job: nuget_ms_react_native_public_job
displayName: NuGet to ADO ms/react-native-public feed
templateContext:
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" /><!-- 4.1.0 is compatible with .NET Standard -->
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.JavaScript.LibNode" Version="26.0.18" />
<PackageVersion Include="Microsoft.JavaScript.LibNode" Version="26.1.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.10.91" />
Expand Down
Loading