@@ -24,58 +24,21 @@ parameters:
2424 type : boolean
2525 default : false
2626
27- - name : publishToConsumptionFeed
28- displayName : 📡 Publish to msft_consumption feed
29- type : boolean
30- default : false
31-
32- - name : buildSteps
33- type : stepList
34- default :
35- - task : NodeTool@0
36- inputs :
37- versionSpec : ' 22.21.1'
38- displayName : Select Node version
39-
40- - script : npm install
41- workingDirectory : $(Build.SourcesDirectory)/pythonEnvironmentsApi
42- displayName : Install package dependencies
43-
44- - script : npm run compile
45- workingDirectory : $(Build.SourcesDirectory)/pythonEnvironmentsApi
46- displayName : Compile TypeScript
47-
48- - script : npm pack --ignore-scripts
49- workingDirectory : $(Build.SourcesDirectory)/pythonEnvironmentsApi
50- displayName : Pack npm package
51-
5227variables :
5328 - name : TeamName
5429 value : vscode-python-environments
5530 - name : PackageName
5631 value : ' @vscode/python-environments'
5732 - name : PackageDir
58- value : pythonEnvironmentsApi
33+ value : api
5934 - name : npmTag
6035 ${{ if eq(parameters.quality, 'preview') }} :
6136 value : next
6237 ${{ else }} :
6338 value : latest
64- - name : AzureArtifactsFeedUrl
65- value : ' https://pkgs.dev.azure.com/azure-public/vside/_packaging/python-environments/npm/registry/'
66- # Same URL without the https:// prefix (used in .npmrc auth lines)
67- - name : AzureArtifactsFeedUrlNoProtocol
68- value : ' pkgs.dev.azure.com/azure-public/vside/_packaging/python-environments/npm/registry/'
69- # Managed Identity service connection for Azure Artifacts auth (shared with Pylance)
70- - name : AzureServiceConnection
71- 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/'
7639
7740extends :
78- template : azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
41+ template : azure-pipelines/MicroBuild.1ES.Official.Publish. yml@MicroBuildTemplate
7942 parameters :
8043 sdl :
8144 sourceAnalysisPool : VSEngSS-MicroBuild2022-1ES
@@ -103,122 +66,44 @@ extends:
10366 targetPath : $(Build.ArtifactStagingDirectory)
10467 artifactName : npm-package
10568 steps :
106- - ${{ each step in parameters.buildSteps }} :
107- - ${{ step }}
69+ - task : NodeTool@0
70+ inputs :
71+ versionSpec : ' 22.21.1'
72+ displayName : Select Node version
73+
74+ - script : npm install
75+ workingDirectory : $(Build.SourcesDirectory)/api
76+ displayName : Install package dependencies
77+
78+ - script : npm run compile
79+ workingDirectory : $(Build.SourcesDirectory)/api
80+ displayName : Compile TypeScript
81+
82+ - script : npm pack --ignore-scripts
83+ workingDirectory : $(Build.SourcesDirectory)/api
84+ displayName : Pack npm package
10885
10986 - task : CopyFiles@2
11087 displayName : Copy package tarball to staging
11188 inputs :
112- sourceFolder : $(Build.SourcesDirectory)/pythonEnvironmentsApi
89+ sourceFolder : $(Build.SourcesDirectory)/api
11390 contents : ' *.tgz'
11491 targetFolder : $(Build.ArtifactStagingDirectory)
11592
116- - stage : Publish
117- displayName : Publish to Azure Artifacts
93+ - stage : Publish to NPM
94+ displayName : Publish to NPM
11895 dependsOn : Build
11996 condition : and(succeeded(), eq('${{ parameters.publishPackage }}', 'true'))
12097 jobs :
12198 - job : PublishPackage
122- displayName : Publish $(PackageName)
123- templateContext :
124- type : releaseJob
125- isProduction : true
126- inputs :
127- - input : pipelineArtifact
128- artifactName : npm-package
129- targetPath : $(Pipeline.Workspace)/npm-package
99+ displayName : Publish npm package
130100 steps :
131- - checkout : none
132-
133- - task : NodeTool@0
134- inputs :
135- versionSpec : ' 22.21.1'
136- displayName : Select Node version
137-
138- # Acquire a short-lived AAD token via Managed Identity (no stored secrets)
139- # SEE https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance
140- - task : AzureCLI@2
141- displayName : Acquire AAD token via Managed Identity
142- inputs :
143- azureSubscription : ' $(AzureServiceConnection)'
144- scriptType : ' pscore'
145- scriptLocation : ' inlineScript'
146- inlineScript : |
147- $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
148- Write-Host "##vso[task.setvariable variable=AzdoToken;issecret=true]$token"
149-
150- - powershell : |
151- @"
152- registry=$(AzureArtifactsFeedUrl)
153- always-auth=true
154- "@ | Out-File -FilePath .npmrc
155-
156- @"
157- ; begin auth token
158- //$(AzureArtifactsFeedUrlNoProtocol):username=VssSessionToken
159- //$(AzureArtifactsFeedUrlNoProtocol):_authToken=$env:AZDO_TOKEN
160- //$(AzureArtifactsFeedUrlNoProtocol):email=not-used@example.com
161- ; end auth token
162- "@ | Out-File -FilePath $HOME/.npmrc
163- env:
164- AZDO_TOKEN: $(AzdoToken)
165- displayName: Create .npmrc files
166-
167- - powershell : |
168- $tgz = Get-ChildItem "$(Pipeline.Workspace)/npm-package/*.tgz" | Select-Object -First 1
169- if (-not $tgz) {
170- Write-Error "No .tgz file found in $(Pipeline.Workspace)/npm-package/"
171- exit 1
172- }
173- Write-Host "Publishing: $($tgz.FullName)"
174- if ("$(npmTag)" -eq "next") {
175- npm publish $tgz.FullName --registry $(AzureArtifactsFeedUrl) --tag next --ignore-scripts
176- } else {
177- npm publish $tgz.FullName --registry $(AzureArtifactsFeedUrl) --ignore-scripts
178- }
179- 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
101+ - template : MicroBuild.Publish.yml@MicroBuildTemplate
102+ parameters :
103+ intent : ' PackageDistribution'
104+ contentType : ' npm'
105+ contentSource : ' Folder'
106+ folderLocation : ' $(Build.ArtifactStagingDirectory)'
107+ waitForReleaseCompletion : true
108+ owners : ' plseng@microsoft.com'
109+ approvers : ' eduardovil@microsoft.com;grwheele@microsoft.com'
0 commit comments