1+ # Node.js
2+ # Build a general Node.js project with npm.
3+ # Add steps that analyze code, save build artifacts, deploy, and more:
4+ # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
5+
6+ trigger :
7+ - johnshew/login
8+
9+ variables :
10+ # Azure Resource Manager connection created during pipeline creation
11+ azureSubscription : ' fe7b93fe-e836-4a55-804c-883dbea6af24'
12+
13+ # Web app name
14+ webAppName : ' vott'
15+
16+ # Agent VM image name
17+ vmImageName : ' ubuntu-latest'
18+
19+ stages :
20+ - stage : Build
21+ displayName : Build stage
22+ jobs :
23+ - job : Build
24+ displayName : Build
25+ pool :
26+ vmImage : $(vmImageName)
27+
28+ steps :
29+ - task : NodeTool@0
30+ inputs :
31+ versionSpec : ' 10.x'
32+ displayName : ' Install Node.js'
33+
34+ - script : |
35+ npm install
36+ npm run build --if-present
37+ # npm run test --if-present
38+ workingDirectory: $(System.DefaultWorkingDirectory)/server
39+ displayName: 'npm install, build and test'
40+
41+ - task : ArchiveFiles@2
42+ displayName : ' Archive files'
43+ inputs :
44+ rootFolderOrFile : ' $(System.DefaultWorkingDirectory)/server'
45+ includeRootFolder : false
46+ archiveType : zip
47+ archiveFile : $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
48+ replaceExistingArchive : true
49+
50+ - upload : $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
51+ artifact : drop
52+
53+ - stage : Deploy
54+ displayName : Deploy stage
55+ dependsOn : Build
56+ condition : succeeded()
57+ jobs :
58+ - deployment : Deploy
59+ displayName : Deploy
60+ environment : ' development'
61+ pool :
62+ vmImage : $(vmImageName)
63+ strategy :
64+ runOnce :
65+ deploy :
66+ steps :
67+ - task : AzureWebApp@1
68+ displayName : ' Azure Web App Deploy: vott'
69+ inputs :
70+ azureSubscription : $(azureSubscription)
71+ appType : webAppLinux
72+ appName : $(webAppName)
73+ runtimeStack : ' NODE|10.10'
74+ package : $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
75+ startUpCommand : ' npm run start'
0 commit comments