typed-rest-client/azure-pipelines.yml

131 строка
4.3 KiB
YAML

# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# This pipeline will be extended to the OneESPT template
trigger:
- master
- releases/*
variables:
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
isRelease: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/releases')]
parameters:
- name: nodeVersionList
type: object
default: [16, 18, 20]
- name: imageList
type: object
default:
windows: 'abtt-windows-2022'
ubuntu: 'abtt-ubuntu-2204'
- name: publishToNpm
displayName: Publish to npm
type: boolean
default: false
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
sdl:
sbom:
enabled: false
sourceAnalysisPool:
name: 1ES-ABTT-Shared-Pool
image: abtt-windows-2022
os: windows
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: Build
displayName: Build typed-rest-client
jobs:
- job: Build_and_Publish
displayName: Build and Publish artifact
pool:
name: 1ES-ABTT-Shared-Pool
image: abtt-ubuntu-2204
os: linux
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish _build artifact'
targetPath: _build
artifactType: pipeline
artifactName: _build
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: Install node 20.x
- task: NpmAuthenticate@0
inputs:
workingFile: .npmrc
- script: npm install
displayName: npm install
- script: npm run build
displayName: npm run build
- stage: Test
displayName: Test typed-rest-client
jobs:
- ${{ each image in parameters.imageList }}:
- ${{ each nodeVersion in parameters.nodeVersionList }}:
- job: Node_os_${{ nodeVersion }}_${{ image.key }}
displayName: Node.js ${{ nodeVersion }} on ${{ image.key }}
pool:
name: 1ES-ABTT-Shared-Pool
image: ${{ image.value }}
os: ${{ image.key }}
steps:
- task: DownloadPipelineArtifact@2
displayName: Download built typed-rest-client package
inputs:
artifact: _build
path: $(Build.SourcesDirectory)/_build
patterns: '!package-lock.json'
- script: npm install
displayName: npm install
- task: NodeTool@0
inputs:
versionSpec: ${{ nodeVersion }}.x
displayName: Install node ${{ nodeVersion }}
- script: npm run units
displayName: npm run units
- script: npm run test
displayName: npm run test
- stage: Publish
condition: and(succeeded(), or(eq('${{ parameters.publishToNpm }}', true), eq(variables.isRelease, true), eq(variables.isMaster, true)))
jobs:
- job: Publish_package
displayName: Publish npm package
pool:
name: 1ES-ABTT-Shared-Pool
image: abtt-ubuntu-2204
os: linux
steps:
- task: DownloadPipelineArtifact@2
displayName: Download built typed-rest-client package
inputs:
artifact: _build
path: $(Build.SourcesDirectory)/_build
- task: Npm@1
displayName: Publish typed-rest-client to npm
inputs:
command: publish
workingDir: '_build'
publishRegistry: useExternalRegistry
publishEndpoint: btt-npm-publish-token
continueOnError: true
- script: npm install
displayName: npm install
continueOnError: true
condition: and(succeeded(), eq(variables.isMaster, true))
- script: node ./ci/create-release-notes.js
continueOnError: true
condition: and(succeeded(), eq(variables.isMaster, true))
env:
GH_TOKEN: $(githubToken)
branch: $(Build.SourceBranchName)
displayName: Create Release