-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yaml
139 lines (114 loc) · 4.1 KB
/
azure-pipelines.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
trigger: none
parameters:
- name: build_environment
type: boolean
default: false
variables:
- group: HealthBuddy-website
stages:
- stage: build_infra
condition: and(succeeded(), ${{ parameters.build_environment }}, true)
jobs:
- job: build_infra
pool:
vmImage: 'windows-latest'
steps:
- task: AzureCLI@1
displayName: 'Azure CLI: Create Azure App Service Plan'
inputs:
azureSubscription: $(azSubscription)
scriptLocation: inlineScript
inlineScript: |
az appservice plan create -n $(appServicePlanName) -g $(resourceGroupName) --sku $(appServicePlanSKU) --location $(location)
- task: AzureCLI@1
displayName: 'Azure CLI: Create Azure web App'
inputs:
azureSubscription: $(azSubscription)
scriptLocation: inlineScript
inlineScript: |
az webapp create -n $(appName) -g $(resourceGroupName) -p $(appServicePlanName)
- stage: build_web_site
condition: always()
jobs:
- job: build_web_site
pool:
vmImage: 'windows-latest'
steps:
- task: DownloadSecureFile@1
name: SecuredConfig
displayName: 'Download Secured Config'
inputs:
secureFile: $(website_source_cfg)
- script: |
echo Deleting "$(website_dest_cfg)" file
del $(website_dest_cfg)
dir
echo Copying new "$(website_dest_cfg)" file
echo Source: $(SecuredConfig.secureFilePath)
echo Destination: $(website_dest_cfg)
copy $(SecuredConfig.secureFilePath) $(website_dest_cfg)
dir
displayName: Updating website config
- script: yarn install
displayName: yarn install
- script: yarn build
displayName: yarn build
- script: |
dir
echo Copying "web.config" file
copy web.config dist\web.config
dir dist
displayName: Updating IIS web.config
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: |
$(System.DefaultWorkingDirectory)/dist/**
TargetFolder: '$(Build.ArtifactStagingDirectory)/output'
displayName: 'Copy source files to artifact directory'
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/output'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- task: PublishPipelineArtifact@0
displayName: 'Publish server pipeline artifacts'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
- stage: deploy_web_site
dependsOn:
- build_web_site
condition: succeeded('build_web_site')
jobs:
- deployment: deploy
displayName: Deploy HB web site
environment: 'website'
pool:
vmImage: 'windows-latest'
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@1
displayName: 'Download Pipeline Artifacts'
inputs:
buildType: 'current'
- task: ExtractFiles@1
displayName: Extract Files
inputs:
archiveFilePatterns: '$(System.ArtifactsDirectory)/drop/$(Build.BuildId).zip'
destinationFolder: '$(System.DefaultWorkingDirectory)/unzip/$(Build.BuildId)'
cleanDestinationFolder: true
- task: AzureCLI@1
displayName: 'Azure CLI: Save container registry secrets'
inputs:
azureSubscription: $(azSubscription)
scriptLocation: inlineScript
inlineScript: |
dir
cd unzip/$(Build.BuildId)/dist
dir
az webapp up --resource-group $(resourceGroupName) --name $(appName) --html