Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f450103

Browse files
Sync eng/common directory with azure-sdk-tools for PR 10921 (Azure#34859)
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#10921 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) Co-authored-by: Wes Haggard <[email protected]>
1 parent 5599237 commit f450103

File tree

1 file changed

+66
-54
lines changed

1 file changed

+66
-54
lines changed

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -164,63 +164,75 @@ extends:
164164
- Build
165165
- ${{ if and(parameters.PublishDependsOnTest, ne(length(parameters.TestMatrix), 0)) }}:
166166
- Test
167+
167168
variables:
168169
buildArtifactsPath: $(Pipeline.Workspace)/build_artifacts
169-
pool: ${{ parameters.Pool }}
170-
jobs:
171-
- job: Publish
172-
steps:
173-
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
174170

175-
- download: current
176-
artifact: build_artifacts
177-
displayName: Download build artifacts
178-
179-
# Create authenticated .npmrc file for publishing to devops
180-
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
181-
parameters:
182-
npmrcPath: $(buildArtifactsPath)/packages/.npmrc
183-
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/
184-
185-
# publish to devops feed
186-
- pwsh: |
187-
$packageFiles = Get-ChildItem -Path . -Filter '*.tgz'
188-
foreach ($file in $packageFiles.Name) {
189-
Write-Host "npm publish $file --verbose --access public"
190-
npm publish $file --verbose --access public
191-
}
192-
displayName: Publish to DevOps feed
193-
workingDirectory: $(buildArtifactsPath)/packages
194-
195-
# Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-net
196-
- ${{ if parameters.HasNugetPackages }}:
197-
- task: 1ES.PublishNuget@1
198-
displayName: Publish NuGet Packages to DevOps feed
199-
inputs:
200-
packagesToPush: $(buildArtifactsPath)/packages/*.nupkg;!$(buildArtifactsPath)/packages/*.symbols.nupkg
201-
packageParentPath: $(buildArtifactsPath)/packages
202-
publishVstsFeed: "29ec6040-b234-4e31-b139-33dc4287b756/fa8c16a3-dbe0-4de2-a297-03065ec1ba3f"
203-
nuGetFeedType: internal
204-
205-
- ${{ if parameters.PublishPublic }}:
206-
# publish to npmjs.org using ESRP
207-
- task: EsrpRelease@9
208-
inputs:
209-
displayName: Publish to npmjs.org
210-
ConnectedServiceName: Azure SDK PME Managed Identity
211-
ClientId: 5f81938c-2544-4f1f-9251-dd9de5b8a81b
212-
DomainTenantId: 975f013f-7f24-47e8-a7d3-abc4752bf346
213-
UseManagedIdentity: true
214-
KeyVaultName: kv-azuresdk-codesign
215-
SignCertName: azure-sdk-esrp-release-certificate
216-
Intent: PackageDistribution
217-
ContentType: npm
218-
FolderLocation: $(buildArtifactsPath)/packages
219-
Owners: ${{ coalesce(variables['Build.RequestedForEmail'], '[email protected]') }}
220-
Approvers: ${{ coalesce(variables['Build.RequestedForEmail'], '[email protected]') }}
221-
ServiceEndpointUrl: https://api.esrp.microsoft.com
222-
MainPublisher: ESRPRELPACMANTEST
171+
jobs:
172+
- deployment: Publish
173+
environment: none
174+
175+
pool:
176+
name: azsdk-pool
177+
image: windows-2022 # Nuget publish requires .NET framework on windows to handle the auth
178+
os: windows
179+
180+
templateContext:
181+
type: releaseJob
182+
isProduction: true
183+
inputs: # All input build artifacts must be declared here
184+
- input: pipelineArtifact # Required, type of the input artifact
185+
artifactName: build_artifacts
186+
targetPath: $(buildArtifactsPath)
223187

188+
strategy:
189+
runOnce:
190+
deploy:
191+
steps:
192+
# Create authenticated .npmrc file for publishing to devops
193+
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
194+
parameters:
195+
npmrcPath: $(buildArtifactsPath)/packages/.npmrc
196+
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/
197+
198+
# publish to devops feed
199+
- pwsh: |
200+
$packageFiles = Get-ChildItem -Path . -Filter '*.tgz'
201+
foreach ($file in $packageFiles.Name) {
202+
Write-Host "npm publish $file --verbose --access public"
203+
npm publish $file --verbose --access public
204+
}
205+
displayName: Publish to DevOps feed
206+
workingDirectory: $(buildArtifactsPath)/packages
207+
208+
# Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-net
209+
- ${{ if parameters.HasNugetPackages }}:
210+
- task: 1ES.PublishNuget@1
211+
displayName: Publish NuGet Packages to DevOps feed
212+
inputs:
213+
packagesToPush: $(buildArtifactsPath)/packages/*.nupkg;!$(buildArtifactsPath)/packages/*.symbols.nupkg
214+
packageParentPath: $(buildArtifactsPath)/packages
215+
publishVstsFeed: "public/azure-sdk-for-net"
216+
217+
- ${{ if parameters.PublishPublic }}:
218+
# publish to npmjs.org using ESRP
219+
- task: EsrpRelease@9
220+
inputs:
221+
displayName: Publish to npmjs.org
222+
ConnectedServiceName: Azure SDK PME Managed Identity
223+
ClientId: 5f81938c-2544-4f1f-9251-dd9de5b8a81b
224+
DomainTenantId: 975f013f-7f24-47e8-a7d3-abc4752bf346
225+
UseManagedIdentity: true
226+
KeyVaultName: kv-azuresdk-codesign
227+
SignCertName: azure-sdk-esrp-release-certificate
228+
Intent: PackageDistribution
229+
ContentType: npm
230+
FolderLocation: $(buildArtifactsPath)/packages
231+
Owners: ${{ coalesce(variables['Build.RequestedForEmail'], '[email protected]') }}
232+
Approvers: ${{ coalesce(variables['Build.RequestedForEmail'], '[email protected]') }}
233+
ServiceEndpointUrl: https://api.esrp.microsoft.com
234+
MainPublisher: ESRPRELPACMANTEST
235+
224236
# Regenerate stage
225237
# Responsible for regenerating the SDK code using the emitter package and the generation matrix.
226238
- ${{ if and(parameters.ShouldPublish, parameters.ShouldRegenerate) }}:
@@ -506,4 +518,4 @@ extends:
506518
scriptType: "bash"
507519
scriptLocation: "inlineScript"
508520
inlineScript: npx tsp-spector upload-coverage --coverageFile $(Build.ArtifactStagingDirectory)/tsp-spector-coverage-azure.json --generatorName @azure-typespec/$(SpectorName) --storageAccountName typespec --containerName coverages --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure
509-
workingDirectory: $(Build.SourcesDirectory)/eng/packages/$(SpectorName)
521+
workingDirectory: $(Build.SourcesDirectory)/eng/packages/$(SpectorName)

0 commit comments

Comments
 (0)