1+ #
2+ # The Release pipeline entry point.
3+ # It releases npm packages to npmjs.com and NuGet packages to the public
4+ # ms/react-native and ms/react-native-public ADO feeds and to nuget.org.
5+ #
6+ # The pipeline completion trigger is defined below in the pipeline resource.
7+ # Do NOT add a build completion trigger in the ADO UI — UI triggers override
8+ # YAML triggers and cause the pipeline to always run against the default branch
9+ # with incorrect metadata (wrong commit message and branch).
10+ #
11+
112name : RNW NuGet Release $(Date:yyyyMMdd).$(Rev:r)
213
314trigger : none
15+ pr : none
416
517resources :
618 pipelines :
@@ -10,12 +22,16 @@ resources:
1022 trigger :
1123 branches :
1224 include :
13- - -1espublish
25+ - main
26+ - refs/heads/main
27+ - ' *-stable'
28+ - ' refs/heads/*-stable'
1429 repositories :
1530 - repository : 1ESPipelineTemplates
1631 type : git
1732 name : 1ESPipelineTemplates/1ESPipelineTemplates
1833 ref : refs/tags/release
34+
1935extends :
2036 template : v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
2137 parameters :
@@ -28,13 +44,18 @@ extends:
2844 stages :
2945 - stage : Release
3046 displayName : Publish artifacts
47+ # Allow manual runs unconditionally; for build-completion triggers,
48+ # only proceed if the commit message starts with 'RELEASE:'.
49+ condition : or(eq(variables['Build.Reason'], 'Manual'), startsWith(variables['Build.SourceVersionMessage'], 'RELEASE:'))
3150 jobs :
3251 - job : PushNpm
3352 displayName : npmjs.com - Publish npm packages
3453 variables :
3554 - group : RNW Secrets
36- timeoutInMinutes : 0
55+ timeoutInMinutes : 30
3756 templateContext :
57+ type : releaseJob
58+ isProduction : true
3859 inputs :
3960 - input : pipelineArtifact
4061 pipeline : ' Publish'
@@ -45,15 +66,13 @@ extends:
4566 artifactName : ' VersionEnvVars'
4667 targetPath : ' $(Pipeline.Workspace)/VersionEnvVars'
4768 steps :
48- - checkout : self
49- clean : false
5069 - task : CmdLine@2
5170 displayName : Apply version variables
5271 inputs :
5372 script : node $(Pipeline.Workspace)/VersionEnvVars/versionEnvVars.js
5473 - script : dir /s "$(Pipeline.Workspace)\published-packages"
5574 displayName : Show npm packages before cleanup
56- - script : node .ado/scripts/ npmPack.js --no-pack --check-npm --no-color "$(Pipeline.Workspace)\published-packages"
75+ - script : node "$(Pipeline.Workspace)\VersionEnvVars\ npmPack.js" --no-pack --check-npm --no-color "$(Pipeline.Workspace)\published-packages"
5776 displayName : Remove already published packages
5877 - script : dir /s "$(Pipeline.Workspace)\published-packages"
5978 displayName : Show npm packages after cleanup
@@ -82,112 +101,69 @@ extends:
82101
83102 - job : PushPrivateAdo
84103 displayName : ADO - nuget - react-native
85-
104+ timeoutInMinutes : 30
86105 templateContext :
106+ type : releaseJob
107+ isProduction : true
87108 inputs :
88109 - input : pipelineArtifact
89110 pipeline : ' Publish'
90111 artifactName : ' ReactWindows-final-nuget'
91112 targetPath : ' $(Pipeline.Workspace)/ReactWindows-final-nuget'
92-
93113 steps :
94- - checkout : none
95-
96- - script : dir /S $(Pipeline.Workspace)\ReactWindows-final-nuget
97- displayName : Show directory contents
98-
99- - task : AzureCLI@2
100- displayName : Override NuGet credentials with Managed Identity
101- inputs :
102- azureSubscription : ' Office-React-Native-Windows-Bot'
103- visibleAzLogin : false
104- scriptType : ' pscore'
105- scriptLocation : ' inlineScript'
106- inlineScript : |
107- $accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
108- # Set the access token as a secret, so it doesn't get leaked in the logs
109- Write-Host "##vso[task.setsecret]$accessToken"
110- # Override the apitoken of the nuget service connection, for the duration of this stage
111- Write-Host "##vso[task.setendpoint id=a7e33797-4804-4a1d-911d-5bd325e50a85;field=authParameter;key=apitoken]$accessToken"
112-
113- - task : 1ES.PublishNuGet@1
114- displayName : NuGet push to ms/react-native-public
115- inputs :
116- useDotNetTask : true
114+ - template : .ado/templates/publish-nuget-to-ado-feed.yml@self
115+ parameters :
116+ endpointId : ' a7e33797-4804-4a1d-911d-5bd325e50a85'
117+ nugetFeedUrl : ' https://pkgs.dev.azure.com/ms/_packaging/react-native/nuget/v3/index.json'
117118 packageParentPath : ' $(Pipeline.Workspace)/ReactWindows-final-nuget'
118119 packagesToPush : ' $(Pipeline.Workspace)/ReactWindows-final-nuget/*.nupkg'
119- nuGetFeedType : external
120120 publishFeedCredentials : ' ms/react-native ADO Feed'
121- externalEndpoint : ' ms/react-native ADO Feed'
122- publishPackageMetadata : true
121+ feedDisplayName : ' ms/react-native'
123122
124123 - job : PushPublicAdo
125124 displayName : ADO - nuget - react-native-public
126-
125+ timeoutInMinutes : 30
127126 templateContext :
127+ type : releaseJob
128+ isProduction : true
128129 inputs :
129130 - input : pipelineArtifact
130131 pipeline : ' Publish'
131132 artifactName : ' ReactWindows-final-nuget'
132133 targetPath : ' $(Pipeline.Workspace)/ReactWindows-final-nuget'
133-
134134 steps :
135- - checkout : none
136-
137- - script : dir /S $(Pipeline.Workspace)\ReactWindows-final-nuget
138- displayName : Show directory contents
139-
140- - task : AzureCLI@2
141- displayName : Override NuGet credentials with Managed Identity
142- inputs :
143- azureSubscription : ' Office-React-Native-Windows-Bot'
144- visibleAzLogin : false
145- scriptType : ' pscore'
146- scriptLocation : ' inlineScript'
147- inlineScript : |
148- $accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
149- # Set the access token as a secret, so it doesn't get leaked in the logs
150- Write-Host "##vso[task.setsecret]$accessToken"
151- # Override the apitoken of the nuget service connection, for the duration of this stage
152- Write-Host "##vso[task.setendpoint id=9a2456d0-c163-405b-be24-c03fd74b155a;field=authParameter;key=apitoken]$accessToken"
153-
154- - task : 1ES.PublishNuGet@1
155- displayName : NuGet push to ms/react-native-public
156- inputs :
157- useDotNetTask : true
135+ - template : .ado/templates/publish-nuget-to-ado-feed.yml@self
136+ parameters :
137+ endpointId : ' 9a2456d0-c163-405b-be24-c03fd74b155a'
138+ nugetFeedUrl : ' https://pkgs.dev.azure.com/ms/react-native/_packaging/react-native-public/nuget/v3/index.json'
158139 packageParentPath : ' $(Pipeline.Workspace)/ReactWindows-final-nuget'
159140 packagesToPush : ' $(Pipeline.Workspace)/ReactWindows-final-nuget/*.nupkg'
160- nuGetFeedType : external
161141 publishFeedCredentials : ' ms/react-native-public ADO Feed'
162- externalEndpoint : ' ms/react-native-public ADO Feed'
163- publishPackageMetadata : true
142+ feedDisplayName : ' ms/react-native-public'
164143
165144 - job : PushNuGetOrg
166145 displayName : nuget.org - Push nuget packages
167146 variables :
168147 - group : RNW Secrets
169- timeoutInMinutes : 0
148+ timeoutInMinutes : 30
170149 templateContext :
150+ type : releaseJob
151+ isProduction : true
171152 inputs :
172153 - input : pipelineArtifact
173154 pipeline : ' Publish'
174155 artifactName : ' ReactWindows-final-nuget'
175156 targetPath : ' $(Pipeline.Workspace)/ReactWindows-final-nuget'
176157 steps :
177- - checkout : none
178158 - task : NuGetToolInstaller@1
179- displayName : ' Use NuGet '
159+ displayName : ' Use NuGet'
180160 - task : CmdLine@2
181161 displayName : NuGet SetApiKey (nuget.org)
182162 inputs :
183163 script : nuget.exe SetApiKey $(nugetorg-apiKey-push)
184164 workingDirectory : $(Pipeline.Workspace)/ReactWindows-final-nuget
185- - task : PowerShell@2
165+ - script : dir /S "$(Pipeline.Workspace)\ReactWindows-final-nuget"
166+ displayName : Show directory contents
167+ - script : nuget.exe push .\Microsoft.ReactNative.*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -NoSymbol -NonInteractive -Verbosity Detailed
186168 displayName : NuGet push (nuget.org)
187- inputs :
188- targetType : inline
189- errorActionPreference : silentlyContinue
190- script : |
191- if (Get-ChildItem -Path .\ -Filter '*0.0.0-canary*' -ErrorAction SilentlyContinue) { Write-Output "Canary builds found, exiting."; return 0; }
192- nuget.exe push .\Microsoft.ReactNative.*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -NoSymbol -NonInteractive -Verbosity Detailed
193- workingDirectory : $(Pipeline.Workspace)/ReactWindows-final-nuget
169+ workingDirectory : $(Pipeline.Workspace)/ReactWindows-final-nuget
0 commit comments