@@ -20,7 +20,12 @@ parameters:
2020 - preview
2121
2222 - name : publishPackage
23- displayName : 🚀 Publish to npm
23+ displayName : 🚀 Publish npm
24+ type : boolean
25+ default : false
26+
27+ - name : publishToConsumptionFeed
28+ displayName : 📡 Publish to msft_consumption feed
2429 type : boolean
2530 default : false
2631
@@ -64,6 +69,10 @@ variables:
6469 # Managed Identity service connection for Azure Artifacts auth (shared with Pylance)
6570 - name : AzureServiceConnection
6671 value : ' PylanceSecureVsIdePublishWithManagedIdentity'
72+ - name : ConsumptionFeedUrl
73+ value : ' https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/npm/registry/'
74+ - name : ConsumptionFeedUrlNoProtocol
75+ value : ' pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/npm/registry/'
6776
6877extends :
6978 template : azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
@@ -168,3 +177,48 @@ extends:
168177 npm publish $tgz.FullName --registry $(AzureArtifactsFeedUrl) --ignore-scripts
169178 }
170179 displayName: npm publish (${{ parameters.quality }})
180+
181+ - stage : PublishConsumption
182+ displayName : Publish package to msft_consumption feed
183+ dependsOn : Publish
184+ condition : and(not(failed()), eq('${{ parameters.publishToConsumptionFeed }}', 'true'))
185+ jobs :
186+ - job : PullToConsumption
187+ displayName : Pull $(PackageName) to msft_consumption
188+ steps :
189+ - checkout : none
190+
191+ - task : NodeTool@0
192+ inputs :
193+ versionSpec : ' 22.21.1'
194+ displayName : Select Node version
195+
196+ - task : AzureCLI@2
197+ displayName : Acquire AAD token via Managed Identity
198+ inputs :
199+ azureSubscription : ' $(AzureServiceConnection)'
200+ scriptType : ' pscore'
201+ scriptLocation : ' inlineScript'
202+ inlineScript : |
203+ $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
204+ Write-Host "##vso[task.setvariable variable=AzdoToken;issecret=true]$token"
205+
206+ - powershell : |
207+ @"
208+ registry=$(ConsumptionFeedUrl)
209+ always-auth=true
210+ "@ | Out-File -FilePath .npmrc
211+
212+ @"
213+ ; begin auth token
214+ //$(ConsumptionFeedUrlNoProtocol):username=VssSessionToken
215+ //$(ConsumptionFeedUrlNoProtocol):_authToken=$env:AZDO_TOKEN
216+ //$(ConsumptionFeedUrlNoProtocol):email=not-used@example.com
217+ ; end auth token
218+ "@ | Out-File -FilePath $HOME/.npmrc
219+ env:
220+ AZDO_TOKEN: $(AzdoToken)
221+ displayName: Create .npmrc files
222+
223+ - script : npm i -g $(PackageName)@$(npmTag) --registry $(ConsumptionFeedUrl)
224+ displayName : Pull to msft_consumption
0 commit comments