-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
105 lines (89 loc) · 4.75 KB
/
azure-pipelines.yml
File metadata and controls
105 lines (89 loc) · 4.75 KB
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:
batch: 'true'
branches:
include:
- master
- development
- development-*
resources:
pipelines:
- pipeline: 'ModulesCommonPipeline'
source: 'Modules'
trigger: true
- pipeline: 'ModulesImportersPipeline'
source: 'Modules.Importers'
trigger: true
- pipeline: 'ModulesDotNetPipeline'
source: 'Modules.NET'
trigger: true
variables:
- group: 'Pipeline Agent Pool Names'
pool:
name: $(BuildPool.AzureManaged)
demands:
- 'ImageOverride -equals ubuntu-latest'
steps:
# checkout the branch docs repo
- checkout: self
persistCredentials: 'true'
fetchDepth: '1'
displayName: 'Checkout Docs branch'
# calculate the repo and branch which triggered this pipeline
- powershell: |
if ("$(Resources.TriggeringAlias)" -eq "ModulesCommonPipeline") {
Write-Host "##vso[task.setvariable variable=triggeredByPipeline]Modules"
Write-Host "##vso[task.setvariable variable=triggeredByBranch]$(resources.pipeline.ModulesCommonPipeline.sourceBranch)"
$branchName = "$(resources.pipeline.ModulesCommonPipeline.sourceBranch)" -replace '^refs/heads/', ''
Write-Host "##vso[task.setvariable variable=triggeredByBranchNameOnly]$branchName"
}
elseif ("$(Resources.TriggeringAlias)" -eq "ModulesImportersPipeline") {
Write-Host "##vso[task.setvariable variable=triggeredByPipeline]Modules.Importers"
Write-Host "##vso[task.setvariable variable=triggeredByBranch]$(resources.pipeline.ModulesImportersPipeline.sourceBranch)"
$branchName = "$(resources.pipeline.ModulesImportersPipeline.sourceBranch)" -replace '^refs/heads/', ''
Write-Host "##vso[task.setvariable variable=triggeredByBranchNameOnly]$branchName"
}
elseif ("$(Resources.TriggeringAlias)" -eq "ModulesDotNetPipeline") {
Write-Host "##vso[task.setvariable variable=triggeredByPipeline]Modules.NET"
Write-Host "##vso[task.setvariable variable=triggeredByBranch]$(resources.pipeline.ModulesDotNetPipeline.sourceBranch)"
$branchName = "$(resources.pipeline.ModulesDotNetPipeline.sourceBranch)" -replace '^refs/heads/', ''
Write-Host "##vso[task.setvariable variable=triggeredByBranchNameOnly]$branchName"
}
else {
Write-Host "##vso[task.setvariable variable=triggeredByPipeline]Docs"
Write-Host "##vso[task.setvariable variable=triggeredByBranch]$(Build.SourceBranchName)"
$branchName = "$(Build.SourceBranchName)" -replace '^refs/heads/', ''
Write-Host "##vso[task.setvariable variable=triggeredByBranchNameOnly]$branchName"
}
displayName: 'Determine and Set Variables for Triggered Pipeline'
- pwsh: |
Write-Host "Triggered By Pipeline: $(triggeredByPipeline)"
Write-Host "Triggered By Branch: $(triggeredByBranch)"
Write-Host "Triggered By BranchNameOnly: $(triggeredByBranchNameOnly)"
displayName: 'Output pipeline variables'
- template: PipelineScripts/templates/merge-modules.steps.yml
parameters:
branchName: development
- pwsh: |
dotnet tool install docfx --version 2.78.5
displayName: 'dotnet tool install docfx'
- pwsh: |
dotnet docfx $(Build.SourcesDirectory)/docfx.json
displayName: 'run docfx'
- task: AzureCLI@2
displayName: 'Pre-production storage sync'
condition: and(succeeded(), ne(variables['triggeredByBranch'], 'master'), ne(variables['triggeredByBranch'], 'refs/heads/master'), ne(variables['triggeredByBranch'], 'development'), ne(variables['triggeredByBranch'], 'refs/heads/development'))
inputs:
azureSubscription: 'Intent Architect Azure Resource Group'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az storage blob sync -s '$(Build.SourcesDirectory)/_site' -d '$(triggeredByBranchNameOnly)/' --container '$(intentarchitect.storageContainer)' --account-name '$(intentarchitect.preprod.storageAccountName)' --account-key '$(intentarchitect.preprod.storageAccountKey)' --delete-destination 'true'
- task: AzureCLI@2
displayName: 'Production storage sync'
condition: and(succeeded(), or(eq(variables['triggeredByBranch'], 'master'), eq(variables['triggeredByBranch'], 'refs/heads/master'), eq(variables['triggeredByBranch'], 'development'), eq(variables['triggeredByBranch'], 'refs/heads/development')))
inputs:
azureSubscription: 'Intent Architect Azure Resource Group'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az storage blob sync -s '$(Build.SourcesDirectory)/_site' --container '$(intentarchitect.storageContainer)' --account-name '$(intentarchitect.storageAccountName)' --account-key '$(intentarchitect.storageAccountKey)' --delete-destination 'true'