-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
111 lines (97 loc) · 3.94 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
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
trigger:
branches:
include:
- master
tags:
include:
- "*"
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
isTagBuild: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/')]
buildNumber: $[replace(variables['build.BuildNumber'], '.', '')]
envName: 'RxMqTestEnvironment$(buildNumber)'
jobs:
- job: 'build'
steps:
- task: DotNetCoreCLI@2
displayName: restore
inputs:
command: 'restore'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: build solutions
inputs:
command: 'build'
- task: DownloadSEcureFile@1
name: devSettings
displayName: fetch development settings
inputs:
secureFile: 'developer-settings.json'
- task: AzurePowerShell@5
displayName: create environment
inputs:
azureSubscription: 'Development-use'
ScriptType: 'FilePath'
ScriptPath: '$(Build.SourcesDirectory)/Testing/Prepare-environment.ps1'
ScriptArguments:
-SettingsFile $(devSettings.secureFilePath) `
-EnvironmentName $(envName)
azurePowerShellVersion: 'LatestVersion'
- task: AzurePowerShell@5
displayName: create secrets
inputs:
azureSubscription: 'Development-use'
ScriptType: 'FilePath'
ScriptPath: '$(Build.SourcesDirectory)/Create-ClientSecrets.ps1'
ScriptArguments:
-SettingsFile $(devSettings.secureFilePath) `
-EnvironmentName $(envName)
azurePowerShellVersion: 'LatestVersion'
- task: DotNetCoreCLI@2
displayName: tests
inputs:
command: test
projects: '**/*test*.csproj'
- task: AzureResourceManagerTemplateDeployment@3
displayName: remove environment
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'Development-use'
subscriptionId: '594dd722-b5c7-449c-91ae-e9ab9a54b660'
action: 'DeleteRG'
resourceGroupName: $(envName)
- job: 'publish'
dependsOn: 'build'
condition: and(succeeded(), eq(variables.isTagBuild, true))
steps:
- pwsh: |
$tag = ($Env:BUILD_SOURCEBRANCH -Replace 'refs/tags/','')
Write-Host "##vso[task.setvariable variable=buildTag;]$($tag)"
- task: PowerShell@2
displayName: publish abstractions nuget packages
inputs:
targetType: 'inline'
script: |
dotnet pack $(Build.SourcesDirectory)\Protacon.RxMq.Abstractions\Protacon.RxMq.Abstractions.csproj -c Release -o $(Build.SourcesDirectory)\Protacon.RxMq.Abstractions\artifacts /p:Version=$(buildTag)
cd $(Build.SourcesDirectory)\Protacon.RxMq.Abstractions\artifacts
dotnet nuget push Protacon.RxMq.Abstractions.$(buildTag).nupkg --api-key $(nugetApiKey) --source https://api.nuget.org/v3/index.json
- task: PowerShell@2
displayName: publish AzureServiceBus nuget packages
inputs:
targetType: 'inline'
script: |
dotnet pack $(Build.SourcesDirectory)\Protacon.RxMq.AzureServiceBus\Protacon.RxMq.AzureServiceBus.csproj -c Release -o $(Build.SourcesDirectory)\Protacon.RxMq.AzureServiceBus\artifacts /p:Version=$(buildTag)
cd $(Build.SourcesDirectory)\Protacon.RxMq.AzureServiceBus\artifacts
dotnet nuget push Protacon.RxMq.AzureServiceBus.$(buildTag).nupkg --api-key $(nugetApiKey) --source https://api.nuget.org/v3/index.json
- task: PowerShell@2
displayName: publish AzureServiceBusLegacy nuget packages
inputs:
targetType: 'inline'
script: |
dotnet pack $(Build.SourcesDirectory)\Protacon.RxMq.AzureServiceBusLegacy\Protacon.RxMq.AzureServiceBusLegacy.csproj -c Release -o $(Build.SourcesDirectory)\Protacon.RxMq.AzureServiceBusLegacy\artifacts /p:Version=$(buildTag)
cd $(Build.SourcesDirectory)\Protacon.RxMq.AzureServiceBusLegacy\artifacts
dotnet nuget push Protacon.RxMq.AzureServiceBusLegacy.$(buildTag).nupkg --api-key $(nugetApiKey) --source https://api.nuget.org/v3/index.json