-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
47 lines (40 loc) · 1.37 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
pool:
name: Azure Pipelines
demands: npm
steps:
- task: Cache@2
displayName: 'Cache Npm Dependencies'
inputs:
key: '**/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
path: '$(Build.SourcesDirectory)/node_modules'
cacheHitVar: CacheRestored
- task: Npm@1
displayName: 'npm ci'
inputs:
command: ci
verbose: false
condition: ne(variables['CacheRestored'], 'true')
- task: Npm@1
displayName: 'npm build'
inputs:
command: custom
verbose: false
customCommand: 'run ci:prod'
- powershell: |
$distExists = Test-Path -Path "$(Build.SourcesDirectory)/dist"
Write-Host "##vso[task.setvariable variable=DistExists]$distExists"
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/dist'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
condition: eq(variables['DistExists'], True) # If dist folder present then copy else skip
- task: ArchiveFiles@2
displayName: 'Archive Files'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
includeRootFolder: false
condition: eq(variables['DistExists'], True)
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
condition: eq(variables['DistExists'], True)