-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
90 lines (76 loc) · 2.45 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
82
83
84
85
86
87
88
89
90
# Azure pipeline CI/CD that builds a react project on every commit
# Commits to master branch deploy it to azure storage account
# For a simpler execution plan uncomment the following section
# to trigger the pipeline only on commits to master branch
trigger:
batch: true
# branches:
# - master
stages:
- stage: Build
pool:
image: ubuntu-latest
jobs:
- job: Build
steps:
- task: NodeTool@0
inputs:
versionSpec: "12.5"
displayName: "Install Node.js"
- task: Cache@2
displayName: Cache npm packages
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json'
path: node_modules
restoreKeys: |
npm | "$(Agent.OS)"
npm
- task: Npm@1
displayName: "npm ci"
inputs:
command: ci
- script: |
npm run lint
displayName: "npm lint"
- script: |
npm test -- --coverage --ci --passWithNoTests
displayName: "npm test"
env:
CI: true #tests will only run once instead of launching the watcher
- script: |
npm run build
displayName: "npm build"
env:
CI: true
- task: CopyFiles@2
displayName: "Copy Files"
inputs:
SourceFolder: "build"
TargetFolder: "$(Build.ArtifactStagingDirectory)"
CleanTargetFolder: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "build"
- stage: Deploy
dependsOn: build
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
jobs:
- deployment: Deploy
pool:
vmImage: windows-latest
environment: "Develop"
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: build
- task: AzureFileCopy@3
inputs:
displayName: 'Copy files to Storage Account Blob'
sourcePath: $(Pipeline.Workspace)/build
azureSubscription: ShowCaseServiceConnection
destination: AzureBlob
storage: blobrubdevopsshowcase
containerName: $web