diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/release.yml new file mode 100644 index 00000000000..8e6f015a1bb --- /dev/null +++ b/.azure-pipelines/release.yml @@ -0,0 +1,117 @@ +# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool. +# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected. +# This pipeline will be extended to the OneESPT template +# The pool section has been filled with placeholder values, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage +# This publishes to https://www.npmjs.com/package/@microsoft/microsoft-graph-types + +name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) +trigger: + tags: + include: + - '*' + +pr: none + +variables: + package_name: 'typescript-msgraph-sdk-v1.0' + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: windows-latest + os: windows + stages: + - stage: build + jobs: + - job: build_v1_0_typings + displayName: Pack v1.0 typings + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish Artifact drop' + targetPath: '$(Build.ArtifactStagingDirectory)/npm' + artifactName: npm_$(package_name) + steps: + - checkout: self + displayName: checkout main + + - task: UseNode@1 + displayName: 'Install Node.js' + inputs: + version: '22.x' + + - script: npm ci + displayName: 'Install npm dependencies' + workingDirectory: '$(Build.SourcesDirectory)' + + - script: npm run build + displayName: 'Build project' + + - script: npm run test + displayName: 'Run tests' + + - task: PowerShell@2 + displayName: 'Copy README.md to packages' + inputs: + filePath: './scripts/copy-readme.ps1' + + # Pack Typescript sdk packages + - script: npm pack --pack-destination=$(Build.ArtifactStagingDirectory)/npm --workspaces + displayName: 'Generate npm packages of the Typescript msgraph sdk' + workingDirectory: '$(Build.SourcesDirectory)' + + + - stage: deploy + displayName: 'Deploy v1.0 Typescript SDK packages' + # This condition deploys on successful CI runs for success builds and also allows for manual deployments from an arbitrary branch + condition: or(and(contains(variables['Build.SourceBranch'], 'refs/tags/'), succeeded()), eq(variables['Build.Reason'], 'Manual')) + dependsOn: + - build + jobs: + - deployment: deploy_npm + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: windows + image: windows-latest + dependsOn: [] + environment: msgraph-npm-org + + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: npm_$(package_name) + targetPath: '$(Build.ArtifactStagingDirectory)/npm' + + strategy: + runOnce: + deploy: + steps: + - task: EsrpRelease@9 + displayName: 'Publish V1.0 NPM package via ESRP Release' + inputs: + connectedservicename: "Federated DevX ESRP Managed Identity Connection" + usemanagedidentity: false + keyvaultname: 'akv-prod-eastus' + authcertname: 'ReferenceLibraryPrivateCert' + signcertname: 'ReferencePackagePublisherCertificate' + clientid: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + intent: 'PackageDistribution' + contenttype: 'npm' + contentsource: 'Folder' + folderlocation: '$(Build.ArtifactStagingDirectory)/npm' + owners: 'mmainer@microsoft.com,gavinbarron@microsoft.com' + approvers: 'mmainer@microsoft.com,christiano@microsoft.com,lramosvea@microsoft.com,gavinbarron@microsoft.com' + serviceendpointurl: 'https://api.esrp.microsoft.com' + mainpublisher: 'ESRPRELPACMAN' + domaintenantid: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' \ No newline at end of file