@@ -9,11 +9,66 @@ trigger:
99pool :
1010 vmImage : ubuntu-latest
1111
12- steps :
13- - script : echo Hello, world!
14- displayName : ' Run a one-line script'
15-
16- - script : |
17- echo Add other tasks to build, test, and deploy your project.
18- echo See https://aka.ms/yaml
19- displayName : ' Run a multi-line script'
12+ stages :
13+ - stage : PRTest
14+ displayName : PR Test Stage
15+ jobs :
16+ - job : PR_Test
17+ condition : and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
18+ steps :
19+ - task : NodeTool@0
20+ inputs :
21+ versionSpec : ' 14.16.x'
22+ displayName : ' Install Node.js'
23+
24+ - script : npm install -g @angular/cli
25+ displayName : ' Install Angular CLI'
26+
27+ - task : Npm@1
28+ inputs :
29+ workingDir : $(System.DefaultWorkingDirectory)/projects/rh-rsa-form-validators
30+ command : ' install'
31+ displayName : ' Install package dependencies'
32+
33+ - task : Npm@1
34+ inputs :
35+ workingDir : $(System.DefaultWorkingDirectory)/projects/rh-rsa-form-validators
36+ command : ' custom'
37+ customCommand : ' run lint'
38+ displayName : ' Run eslint checks'
39+
40+ - task : Npm@1
41+ inputs :
42+ workingDir : $(System.DefaultWorkingDirectory)/projects/rh-rsa-form-validators
43+ command : ' custom'
44+ customCommand : ' run test'
45+ displayName : ' Run unit tests'
46+
47+
48+ - stage : Publish
49+ displayName : Publish to NPM
50+ dependsOn : PRTest
51+ condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
52+ jobs :
53+ - job : Publish_to_npm
54+ steps :
55+ - task : Npm@1
56+ inputs :
57+ workingDir : $(System.DefaultWorkingDirectory)
58+ command : ' install'
59+ displayName : ' Install workspace dependencies'
60+
61+ - task : Npm@1
62+ inputs :
63+ workingDir : $(System.DefaultWorkingDirectory)/projects/rh-rsa-form-validators
64+ command : ' custom'
65+ customCommand : ' run build'
66+ displayName : ' Build package'
67+
68+ - task : Npm@1
69+ inputs :
70+ workingDir : $(System.DefaultWorkingDirectory)/dist/rh-rsa-form-validators
71+ command : ' custom'
72+ customCommand : ' publish --access public'
73+ customEndpoint : ' npm_runninghill'
74+ displayName : ' Publish to npmjs.org'
0 commit comments