-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathazure-pipelines.yaml
71 lines (63 loc) · 2.31 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
# Trigger the pipeline when there are changes to the master branch
trigger:
branches:
include:
- master
# Define variables that will be used throughout the YAML file
variables:
ServiceConnection: 'AzureSC'
FunctionAppName: 'cscicdfcn01'
AppServicePlanName: 'ASP-cscicd-8a98'
StgAccType: 'Standard_LRS'
StgAccName: 'storageaccountcscicd820c'
Location: 'AustraliaEast'
ResourceGroupName: 'cscicd'
VMImage: 'VS2017-Win2016'
stages:
# Define the build stage
- stage: Build
jobs:
- job: Build
pool:
vmImage: '$(VMImage)'
steps:
# Deploy a new Azure Resource Group using the ARM template
- task: AzureResourceGroupDeployment@2
displayName: 'Create Function App'
inputs:
azureSubscription: '$(ServiceConnection)'
resourceGroupName: '$(ResourceGroupName)'
location: '$(Location)'
csmFile: '$(System.DefaultWorkingDirectory)/**/azuredeploy.json'
overrideParameters: '-appName $(FunctionAppName) -storageaccountname $(StgAccName) -storageAccountType $(StgAccType) -runtime "powershell" -powerShellVersion "~6" -location $(Location)'
# ZIP the files ready for a publish task
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveFile: "$(Build.StagingDirectory)/$(Build.BuildId).zip"
# Publish the files so the release job can pick them up
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: "$(Build.StagingDirectory)/$(Build.BuildId).zip"
artifactName: drop
# Define the release stage
- stage: Release
jobs:
- job: Release
pool:
vmImage: '$(VMImage)'
steps:
# Don't check out any code, download the published atrifact from the build stage
- checkout: none
- download: current
artifact: drop
# Use the Azure Function App task to deploy the code to the newly deployed Azure Function App
- task: AzureFunctionApp@1
displayName: 'Azure Function App Deploy'
inputs:
azureSubscription: '$(ServiceConnection)'
appType: functionApp
appName: '$(FunctionAppName)'
package: '$(Pipeline.Workspace)/**/*.zip'