forked from microsoft/typed-rest-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
128 lines (127 loc) · 4.17 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# 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
- 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