-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines-deploy.yml
61 lines (57 loc) · 2.61 KB
/
azure-pipelines-deploy.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
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops
parameters:
environment: 'dev'
provisionInfrastructure: true
deployWebApp: false
deployFunctionApp: false
webAppName: 'unknown'
functionAppName: 'unknown'
slotName: 'staging'
vmImage: 'windows-2019' # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
azureSubscription: ''
jobs:
- job: Deploy
displayName: Deploy job
pool:
vmImage: '${{ parameters.vmImage }}'
steps:
- task: DownloadPipelineArtifact@0 # https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml + https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?tabs=yaml&view=azure-devops#artifact-download
displayName: Download artifacts
enabled: true
inputs:
artifactName: 'artifacts'
targetPath: '$(System.DefaultWorkingDirectory)/artifacts'
- ${{ if eq(parameters.provisionInfrastructure, 'true') }}:
- task: AzureCLI@1
displayName: Provision infrastructure
inputs:
azureSubscription: '${{ parameters.azureSubscription }}'
scriptLocation: 'inlineScript'
addSpnToEnvironment: true
inlineScript: 'az account show'
- ${{ if eq(parameters.deployFunctionApp, 'true') }}:
- task: AzureFunctionApp@1
displayName: Deploy function app
inputs:
azureSubscription: '${{ parameters.azureSubscription }}'
appType: 'functionApp'
appName: '${{ parameters.environment }}-${{ parameters.functionAppName }}'
package: '$(System.DefaultWorkingDirectory)/artifacts/**/Application.Functions.zip'
deploymentMethod: 'auto'
${{ if eq(parameters.environment, 'pro') }}:
deployToSlotOrASE: true
resourceGroupName: '${{ parameters.environment }}-api'
slotName: '${{ parameters.slotName }}'
- ${{ if eq(parameters.deployWebApp, 'true') }}:
- task: AzureWebApp@1
displayName: Deploy web app
inputs:
azureSubscription: '${{ parameters.azureSubscription }}'
appType: 'webApp'
appName: '${{ parameters.environment }}-${{ parameters.webAppName }}'
package: '$(System.DefaultWorkingDirectory)/artifacts/**/Application.Web.zip'
deploymentMethod: 'auto'
${{ if eq(parameters.environment, 'pro') }}:
deployToSlotOrASE: true
resourceGroupName: '${{ parameters.environment }}-api'
slotName: '${{ parameters.slotName }}'