-
Notifications
You must be signed in to change notification settings - Fork 0
/
Full.yml
138 lines (124 loc) · 4.39 KB
/
Full.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
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
name: 1.0$(rev:.r)
# change back to "trigger: none" when not doing Cont Deploy
trigger:
branches:
include:
- main
paths:
exclude:
- .gitignore
- CI.yaml
- README.md
# no PR triggers
pr: none
pool:
vmImage: 'windows-latest'
variables:
clientAppPath: 'spotify-record-collection'
stages:
- stage: Build
displayName: Build
jobs:
- job: BuildClient
steps:
- task: NodeTool@0
displayName: 'Ensure Node Installed'
inputs:
versionSpec: '12.x'
- task: Npm@1
displayName: 'Install ClientApp packages'
inputs:
command: 'install'
workingDir: $(clientAppPath)
- task: PowerShell@2
displayName: 'Update package.json version'
inputs:
filePath: '$(Build.SourcesDirectory)/$(clientAppPath)/SetPackageVersion.ps1'
arguments: '-filePath $(Build.SourcesDirectory)/$(clientAppPath)/package.json -version $(Build.BuildNumber)'
failOnStderr: true
showWarnings: true
pwsh: true
- task: Npm@1
displayName: 'Build ClientApp'
inputs:
command: 'custom'
workingDir: $(clientAppPath)
customCommand: 'run build'
- task: PublishBuildArtifacts@1
displayName: 'Upload ClientApp'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/$(clientAppPath)/build/'
ArtifactName: 'ClientApp'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: 'Upload Deployment'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/SpotifyRecordCollection.Deployment'
ArtifactName: 'Deployment'
publishLocation: 'Container'
- stage: DeployInfrastructure
displayName: Deploy Infrastructure
jobs:
# Track deployments on the environment.
- deployment: DeployInfrastructure
displayName: Deploy Infrastructure
condition: and(succeeded(), ne(variables['skipInfrastructure'], 'true'))
# Creates an environment if it doesn't exist.
environment: 'Live'
strategy:
# Default deployment strategy, more coming...
runOnce:
deploy:
steps:
- checkout: none
- download: none
- task: DownloadBuildArtifacts@0
displayName: 'Download Deployment'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'Deployment'
downloadPath: '$(System.ArtifactsDirectory)'
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Deploy Storage Account'
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'Pay-As-You-Go(f2eec27e-505b-41ff-87a8-b38999936e14)'
subscriptionId: 'f2eec27e-505b-41ff-87a8-b38999936e14'
action: 'Create Or Update Resource Group'
resourceGroupName: 'LiveSpotifyRecordCollection'
location: 'UK South'
templateLocation: 'Linked artifact'
csmFile: '$(System.ArtifactsDirectory)\Deployment\Templates\StorageAccount.Template.json'
csmParametersFile: '$(System.ArtifactsDirectory)\Deployment\StorageAccount.Live.json'
deploymentMode: 'Incremental'
- stage: DeployWeb
displayName: Deploy Web App
jobs:
# Track deployments on the environment.
- deployment: DeployWeb
displayName: Deploy Web App
# Creates an environment if it doesn't exist.
environment: 'Live'
strategy:
# Default deployment strategy, more coming...
runOnce:
deploy:
steps:
- checkout: none
- download: none
- task: DownloadBuildArtifacts@0
displayName: 'Download ClientApp'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'ClientApp'
downloadPath: '$(System.ArtifactsDirectory)'
# Remember to add Storage Blob Data Contributor/Owner role to the Service Principal in Azure Portal (Subscriptions > Access Control)
- task: AzureFileCopy@4
inputs:
SourcePath: '$(System.ArtifactsDirectory)/ClientApp/*' # *ensures parent ClientApp folder not copied.
azureSubscription: 'Pay-As-You-Go(f2eec27e-505b-41ff-87a8-b38999936e14)'
Destination: 'AzureBlob'
storage: 'livespotifyrecordcoll'
ContainerName: '$web'