-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
azure-pipelines.yml
81 lines (67 loc) · 2.24 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
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
pool:
vmImage: "ubuntu-latest"
steps:
- task: gitversion/setup@0
inputs:
versionSpec: "5.x"
- task: gitversion/execute@0
- script: echo "##vso[build.updatebuildnumber]$(GitVersion.SemVer)"
- task: Bash@3
displayName: Update version number in react-spaces package.json
inputs:
targetType: "inline"
script: sed -i "s/0.2.2/$GITVERSIONNUMBER/g" package.json
env:
GITVERSIONNUMBER: $(GitVersion.SemVer)
- task: NodeTool@0
inputs:
versionSpec: "20.x"
checkLatest: true
displayName: "Install Node.js"
- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm | "$(Agent.OS)" | $(Build.SourcesDirectory)/package-lock.json'
path: $(Build.SourcesDirectory)/node_modules
cacheHitVar: CACHE_RESTORED
- task: Npm@1
displayName: "Install the dependencies"
inputs:
command: custom
verbose: false
customCommand: "ci"
condition: ne(variables.CACHE_RESTORED, 'true')
- script: |
npm test
displayName: "Run tests"
- script: |
npm run build
displayName: "Build package"
- script: |
npm run build-storybook
displayName: "Build storybook"
- task: CopyFiles@2
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
displayName: Move storybook package json
inputs:
SourceFolder: ".storybook"
Contents: "package.json"
TargetFolder: "./storybook-static"
OverWrite: true
- task: Npm@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
displayName: Publish react-spaces
inputs:
command: "publish"
publishEndpoint: "NPM"
- task: Npm@1
condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
displayName: Publish react-spaces (BETA)
inputs:
command: "custom"
customCommand: "run publish:beta"
customEndpoint: "NPM"