-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pipeline.yaml
84 lines (66 loc) · 2.27 KB
/
Pipeline.yaml
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
trigger: none
pr:
drafts: false
branches:
include:
- master
workspace:
clean: all
pool:
vmImage: windows-latest
steps:
- checkout: self
clean: true
- task: NodeTool@0
displayName: 'Install Node 18.x'
inputs:
versionSpec: 18.x
checkLatest: true
- script: npm ci
displayName: Install
- script: npm run build
displayName: Build
- script: npm run lint
displayName: Lint
- script: npm run test
displayName: Test
- script: npm run cover
displayName: Cover
- task: PublishCodeCoverageResults@1
displayName: 'Publish Code Coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)\lib\cjs\test\coverage\cobertura-coverage.xml'
reportDirectory: '$(Build.Repository.LocalPath)\lib\cjs\test\coverage\lcov-report'
failIfCoverageEmpty: true
continueOnError: true
# The two tasks from Task Group: npm: Get local and server versions
- powershell: |
$packageName = node -p "require('./package.json').name"
$ver = npm view $packageName version
if (!$ver) {
$ver = 0.0.0
}
Write-Host "##vso[task.setvariable variable=serverVersion]$ver"
Write-Host "Server version found: $ver"
ignoreLASTEXITCODE: true
displayName: 'Get package server version'
- powershell: |
$locVersion= node -p "require('./package.json').version"
Write-Host "##vso[task.setvariable variable=localVersion]$locVersion"
Write-Host "Local version found: $locVersion"
displayName: 'Get package local version'
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build'
inputs:
tags: release
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), gt(variables['localVersion'], variables['serverVersion']))
- script: npm pack
displayName: npm pack
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), gt(variables['localVersion'], variables['serverVersion']))
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Packages'
inputs:
PathtoPublish: 'bentley-ecjson2md-$(localVersion).tgz'
ArtifactName: Packages
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), gt(variables['localVersion'], variables['serverVersion']))