-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-deploy-sa.yml
106 lines (90 loc) · 3.29 KB
/
azure-pipelines-deploy-sa.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
trigger: none
variables:
azSubscription: 'UNI_WEBS - RS-UNI-CHE-HEALTH-BUDDY'
resourceGroup: 'RS-UNI-CHE-HEALTH-BUDDY'
storageAccount: saeuwprd1hbcovid01web
website_source_cfg: 'website.cfg'
website_dest_cfg: '.env.local'
stages:
- stage: build_web_site
jobs:
- job: build_web_site
pool:
vmImage: 'vs2017-win2016'
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
- script: yarn build
- 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: 'vs2017-win2016'
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@2
displayName: Delete old content from BLOB $web
inputs:
azureSubscription: $(azSubscription)
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
az storage blob delete-batch --account-name $(storageAccount) --source `$web
- task: AzureFileCopy@3
displayName: Deploy to BLOB $web
inputs:
SourcePath: '$(System.DefaultWorkingDirectory)/unzip/$(Build.BuildId)/dist'
azureSubscription: $(azSubscription)
Destination: 'AzureBlob'
storage: $(storageAccount)
ContainerName: '$web'