-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
54 lines (48 loc) · 1.99 KB
/
azure-pipelines.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
trigger:
- master
- develop
- ft*
variables:
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
appName: "pr$(System.PullRequest.PullRequestNumber)"
${{ if not(eq(variables['Build.Reason'], 'PullRequest')) }}:
appName: "$(Build.SourceBranchName)"
azureSubscription: question-queue-pipeline
functionappName: queuefunction$(appName)
resourceGroup: math-dojo-hzprod-question-queue-function
pool:
vmImage: 'windows-2019'
steps:
- task: AzureCLI@2
displayName: 'Create AppService'
inputs:
azureSubscription: question-queue-pipeline
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$serviceNameExists = az storage account check-name --name queuefunction$(appName) --subscription 5594cd6c-b674-4323-8517-5e859a399468 | ConvertFrom-Json
Write-Host "Does the service name exist for queuefunction$(appName): $serviceNameExists"
If ($serviceNameExists.nameAvailable) {
az storage account create --name queuefunction$(appName) --kind StorageV2 --location uksouth --resource-group $(resourceGroup) --subscription 5594cd6c-b674-4323-8517-5e859a399468
az functionapp create --resource-group $(resourceGroup) --consumption-plan-location uksouth --name queuefunction$(appName) --storage-account queuefunction$(appName) --os-type Windows --runtime node --functions-version 3 --disable-app-insights true
}
- script: |
npm install
npm run build
displayName: 'Building package'
- task: ArchiveFiles@2
displayName: "Archive files"
inputs:
rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
includeRootFolder: false
archiveFile: "$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip"
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip'
name: 'drop'
- task: AzureRmWebAppDeployment@4
inputs:
connectionType: 'AzureRM'
azureSubscription: "$(azureSubscription)"
appType: 'functionApp'
webAppName: "$(functionappName)"