Skip to content

Sync eng/common directory with azure-sdk-tools for PR 10921 #1927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2025
Merged
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
120 changes: 66 additions & 54 deletions eng/common/pipelines/templates/archetype-typespec-emitter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,63 +164,75 @@ extends:
- Build
- ${{ if and(parameters.PublishDependsOnTest, ne(length(parameters.TestMatrix), 0)) }}:
- Test

variables:
buildArtifactsPath: $(Pipeline.Workspace)/build_artifacts
pool: ${{ parameters.Pool }}
jobs:
- job: Publish
steps:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml

- download: current
artifact: build_artifacts
displayName: Download build artifacts

# Create authenticated .npmrc file for publishing to devops
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(buildArtifactsPath)/packages/.npmrc
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/

# publish to devops feed
- pwsh: |
$packageFiles = Get-ChildItem -Path . -Filter '*.tgz'
foreach ($file in $packageFiles.Name) {
Write-Host "npm publish $file --verbose --access public"
npm publish $file --verbose --access public
}
displayName: Publish to DevOps feed
workingDirectory: $(buildArtifactsPath)/packages

# Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-net
- ${{ if parameters.HasNugetPackages }}:
- task: 1ES.PublishNuget@1
displayName: Publish NuGet Packages to DevOps feed
inputs:
packagesToPush: $(buildArtifactsPath)/packages/*.nupkg;!$(buildArtifactsPath)/packages/*.symbols.nupkg
packageParentPath: $(buildArtifactsPath)/packages
publishVstsFeed: "29ec6040-b234-4e31-b139-33dc4287b756/fa8c16a3-dbe0-4de2-a297-03065ec1ba3f"
nuGetFeedType: internal

- ${{ if parameters.PublishPublic }}:
# publish to npmjs.org using ESRP
- task: EsrpRelease@9
inputs:
displayName: Publish to npmjs.org
ConnectedServiceName: Azure SDK PME Managed Identity
ClientId: 5f81938c-2544-4f1f-9251-dd9de5b8a81b
DomainTenantId: 975f013f-7f24-47e8-a7d3-abc4752bf346
UseManagedIdentity: true
KeyVaultName: kv-azuresdk-codesign
SignCertName: azure-sdk-esrp-release-certificate
Intent: PackageDistribution
ContentType: npm
FolderLocation: $(buildArtifactsPath)/packages
Owners: ${{ coalesce(variables['Build.RequestedForEmail'], 'azuresdk@microsoft.com') }}
Approvers: ${{ coalesce(variables['Build.RequestedForEmail'], 'azuresdk@microsoft.com') }}
ServiceEndpointUrl: https://api.esrp.microsoft.com
MainPublisher: ESRPRELPACMANTEST
jobs:
- deployment: Publish
environment: none

pool:
name: azsdk-pool
image: windows-2022 # Nuget publish requires .NET framework on windows to handle the auth
os: windows

templateContext:
type: releaseJob
isProduction: true
inputs: # All input build artifacts must be declared here
- input: pipelineArtifact # Required, type of the input artifact
artifactName: build_artifacts
targetPath: $(buildArtifactsPath)

strategy:
runOnce:
deploy:
steps:
# Create authenticated .npmrc file for publishing to devops
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(buildArtifactsPath)/packages/.npmrc
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/

# publish to devops feed
- pwsh: |
$packageFiles = Get-ChildItem -Path . -Filter '*.tgz'
foreach ($file in $packageFiles.Name) {
Write-Host "npm publish $file --verbose --access public"
npm publish $file --verbose --access public
}
displayName: Publish to DevOps feed
workingDirectory: $(buildArtifactsPath)/packages

# Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-net
- ${{ if parameters.HasNugetPackages }}:
- task: 1ES.PublishNuget@1
displayName: Publish NuGet Packages to DevOps feed
inputs:
packagesToPush: $(buildArtifactsPath)/packages/*.nupkg;!$(buildArtifactsPath)/packages/*.symbols.nupkg
packageParentPath: $(buildArtifactsPath)/packages
publishVstsFeed: "public/azure-sdk-for-net"

- ${{ if parameters.PublishPublic }}:
# publish to npmjs.org using ESRP
- task: EsrpRelease@9
inputs:
displayName: Publish to npmjs.org
ConnectedServiceName: Azure SDK PME Managed Identity
ClientId: 5f81938c-2544-4f1f-9251-dd9de5b8a81b
DomainTenantId: 975f013f-7f24-47e8-a7d3-abc4752bf346
UseManagedIdentity: true
KeyVaultName: kv-azuresdk-codesign
SignCertName: azure-sdk-esrp-release-certificate
Intent: PackageDistribution
ContentType: npm
FolderLocation: $(buildArtifactsPath)/packages
Owners: ${{ coalesce(variables['Build.RequestedForEmail'], 'azuresdk@microsoft.com') }}
Approvers: ${{ coalesce(variables['Build.RequestedForEmail'], 'azuresdk@microsoft.com') }}
ServiceEndpointUrl: https://api.esrp.microsoft.com
MainPublisher: ESRPRELPACMANTEST

# Regenerate stage
# Responsible for regenerating the SDK code using the emitter package and the generation matrix.
- ${{ if and(parameters.ShouldPublish, parameters.ShouldRegenerate) }}:
Expand Down Expand Up @@ -506,4 +518,4 @@ extends:
scriptType: "bash"
scriptLocation: "inlineScript"
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
workingDirectory: $(Build.SourcesDirectory)/eng/packages/$(SpectorName)
workingDirectory: $(Build.SourcesDirectory)/eng/packages/$(SpectorName)