-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
70 lines (59 loc) · 1.83 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
# 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
name: 1.0$(Rev:.r)
trigger:
- develop
pool:
vmImage: ubuntu-latest
jobs:
- job: node
displayName: Restore and run tests with npm
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- task: WhiteSource@21
inputs:
cwd: '$(System.DefaultWorkingDirectory)'
projectName: 'node-rest-server'
- script: |
npm list -g mocha || npm i -g mocha
displayName: "Install mocha"
- script: |
npm install
npm run test
displayName: 'npm install and test'
- job: publish
displayName: Publish artifact
dependsOn: node
steps:
- task: DownloadSecureFile@1
name: downloadEnvFile
displayName: 'Download .env file'
inputs:
secureFile: '.env.production'
- task: CopyFiles@2
name: copyEnvFile
displayName: 'Copy .env file to publish'
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: '**\.env.production'
TargetFolder: $(Build.Repository.LocalPath)
- script: npm install
displayName: 'Download node modules'
# Compress files into .7z, .tar.gz, or .zip.
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: "$(Build.Repository.LocalPath)"
includeRootFolder: false
archiveType: "zip"
archiveFile: "$(Build.ArtifactStagingDirectory)/drop.zip"
- task: PublishBuildArtifacts@1
displayName: Publish build artifact
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "drop"
publishLocation: "Container"