-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
55 lines (51 loc) · 1.75 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
variables:
# Update build ID if we are working on a feature branch
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
BranchName: ''
Separator: ''
Revision: $[counter('TYDBuildNumber', 1)]
isWebsiteBranchMaster: true
${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
BranchName: ${{ variables['Build.SourceBranchName'] }}
Separator: '.'
Revision: $[counter(variables['Build.SourceBranchName'], 1)]
isWebsiteBranchMaster: false
artifact_name: StaticWebsite
name: $(BranchName)$(Separator)$(Revision)
stages:
- stage: Build
variables:
# Deploy to Production if:
# 1. Website has a new change on Master
deployToProduction: $[ eq(variables['isWebsiteBranchMaster'], true) ]
jobs:
- job: Build
pool:
vmImage: 'ubuntu-18.04'
steps:
- template: .azure-pipelines/npm-restore.yml
- template: .azure-pipelines/npm-build.yml
- template: .azure-pipelines/add-robots.yml
- template: .azure-pipelines/publish-artifact.yml
- stage: Deploy
dependsOn: Build
variables:
# Deploy to Production if:
# 1. Website has a new change on Master
deployToProduction: $[ eq(variables['isWebsiteBranchMaster'], true) ]
jobs:
- job: DeployStage
condition: and(succeeded(), eq(variables['deployToProduction'], 'False'))
pool:
vmImage: 'windows-2019'
steps:
- template: .azure-pipelines/download-artifact.yml
- template: .azure-pipelines/deploy-to-azure.yml
- job: DeployProduction
condition: and(succeeded(), eq(variables['deployToProduction'], 'True'))
pool:
vmImage: 'Ubuntu 16.04'
container: ebati/netlify-cli:latest
steps:
- template: .azure-pipelines/download-artifact.yml
- template: .azure-pipelines/deploy-to-netlify.yml