-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
119 lines (96 loc) · 4.1 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
112
113
114
115
116
117
118
119
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '$(System.DefaultWorkingDirectory)\src\MasternodeSetupTool.sln'
toolProjectPath: '$(System.DefaultWorkingDirectory)\src\MasternodeSetupTool'
minerProjectPath: '$(System.DefaultWorkingDirectory)\StratisFullNode\src\Stratis.CirrusMinerD'
installerProjectPath: '$(System.DefaultWorkingDirectory)\src\MasternodeSetupToolInstaller'
installerProject: '$(installerProjectPath)\MasternodeSetupToolInstaller.vdproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
devCmd: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.com'
disableToolPath: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild'
steps:
- task: PowerShell@2
displayName: Create Version Number
inputs:
targetType: 'inline'
script: |
$bv = "$env:MajorVersion.$env:MinorVersion.$env:PatchVersion"
Write-Host "##vso[task.setvariable variable=buildVersion]$bv"
Write-Host "Version of .NET app : $bv"
- checkout: self
submodules: 'recursive'
- task: NuGetToolInstaller@1
- task: Bash@3
displayName: Build CirrusMinerD
inputs:
targetType: 'inline'
script: |
cd "$(minerProjectPath)"
dotnet build
- task: Bash@3
displayName: Build Masternode Setup Tool
inputs:
targetType: 'inline'
script: |
cd "$(toolProjectPath)"
dotnet build
# https://github.com/it3xl/MSBuild-DevEnv-Build-Server-Workarounds/issues/1#issuecomment-525435637
- task: BatchScript@1
displayName: Enable .vdproj Builds
inputs:
filename: '"$(disableToolPath)\DisableOutOfProcBuild.exe"'
workingFolder: '"$(disableToolPath)"'
- task: Bash@3
displayName: Update ProductVersion
inputs:
targetType: 'inline'
script: 'sed -i ''s/"ProductVersion" = "8:1.0.0"/"ProductVersion" = "8:$(buildVersion)"/'' src/MasternodeSetupToolInstaller/MasternodeSetupToolInstaller.vdproj'
- task: PowerShell@2
displayName: Update ProductCode and PackageCode
inputs:
targetType: 'inline'
script: |
$filePath = "src/MasternodeSetupToolInstaller/MasternodeSetupToolInstaller.vdproj"
# Check if the file exists
if (-not (Test-Path $filePath)) {
Write-Error "File not found: $filePath"
exit 1
}
# Generate a new UUID
$newProductCode = [guid]::NewGuid().ToString().ToUpper()
$newPackageCode = [guid]::NewGuid().ToString().ToUpper()
# Read the file content
$content = Get-Content $filePath -Raw
Write-Output "Previous version of content:"
Write-Output "============================"
Write-Output $content
# Replace the UUID in the "ProductCode" and "PackageCode" strings
$updatedContent = $content -replace '(?<=ProductCode" = "8:{)([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})', $newProductCode
$updatedContent = $updatedContent -replace '(?<=PackageCode" = "8:{)([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})', $newPackageCode
# Save the updated content back to the file
$updatedContent | Set-Content $filePath
Write-Output "New version of content:"
Write-Output "============================"
Write-Output $updatedContent
Write-Output "UUID replaced successfully!"
- script: '"$(devCmd)" "$(solution)" /Build "$(buildConfiguration)" /Project "$(installerProject)"'
displayName: Build Installer
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(installerProjectPath)\$(buildConfiguration)\*.msi'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/MasternodeSetupTool-$(buildVersion).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'