forked from pepijng/node-red-contrib-nefit-easy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
82 lines (73 loc) · 1.88 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
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pr:
- master
pool:
vmImage: ubuntu-latest
resources:
- repo: self
variables:
npm_config_cache: $(Pipeline.Workspace)/.npm
stages:
- stage: Build
jobs:
- job: Build
displayName: Build & Test
strategy:
matrix:
node_12_x:
node_version: 12.x
node_14_x:
node_version: 14.x
node_16_x:
node_version: 16.x
steps:
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
path: $(npm_config_cache)
displayName: Cache npm
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
- script: |
npm install
npm test -- --reporter mocha-junit-reporter
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'test-results.xml'
- stage: Release
displayName: Release a new version to NPM
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: Release
displayName: Release to NPM
pool:
vmImage: ubuntu-latest
steps:
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
path: $(npm_config_cache)
displayName: Cache npm
- task: Npm@1
inputs: # Ensure that the semantic-release tool is installed as specified in the package.json
command: 'install'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
npx semantic-release
env:
GH_TOKEN: $(GH_TOKEN)
NPM_TOKEN: $(NPM_TOKEN)