-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
130 lines (112 loc) · 4.25 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
120
121
122
123
124
125
126
127
128
129
130
variables:
main_project: Heroes.Icons\Heroes.Icons.csproj
publish_any_path: .\bin\publish\any\
nupkg_path: .\bin\nupkg\any\
jobs:
- template: azure-pipelines-template.yml
parameters:
name: Linux
pool:
vmImage: 'ubuntu-latest'
- template: azure-pipelines-template.yml
parameters:
name: macOS
pool:
vmImage: 'macOS-latest'
- template: azure-pipelines-template.yml
parameters:
name: Windows
pool:
vmImage: 'windows-latest'
- job: Artifacts
dependsOn:
- Linux
- macOs
- Windows
pool:
vmImage: 'windows-latest'
variables:
- group: secret
condition: and(succeeded(), ne(variables['build.Reason'], 'PullRequest'))
steps:
- task: DownloadSecureFile@1
displayName: Download cert
inputs:
secureFile: certificate
- task: UseDotNet@2
displayName: 'Use .NET sdk'
inputs:
packageType: sdk
version: 6.0.x
installationPath: $(Agent.ToolsDirectory)\dotnet
- task: NuGetToolInstaller@1
displayName: nuget installer 6.1.0
inputs:
versionSpec: '6.1.0'
- powershell: |
$csproj = get-content Heroes.Icons\Heroes.Icons.csproj
$sv = $csproj | select-string -pattern "<Version>"
$sv -match "<Version>(?<content>.*)</Version>"
$value = $matches['content']
$first_part_version,$build_version = $value.Split("-")
$version = $first_part_version + "-build.$(Build.BuildNumber)"
$csproj.replace($sv, "<Version>$version</Version>") | out-file $env:MAIN_PROJECT
echo "Version - $version"
displayName: Non-master version build number
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: DotNetCoreCLI@2
inputs:
projects: $(MAIN_PROJECT)
command: 'restore'
includeNuGetOrg: true
displayName: 'Restore'
- powershell: dotnet publish $env:MAIN_PROJECT -c release --no-restore -o $env:PUBLISH_ANY_PATH
displayName: Publish release
- powershell: dotnet pack $env:MAIN_PROJECT -c release --no-build -o $env:NUPKG_PATH -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
displayName: Nuget pack
- task: NuGetCommand@2
displayName: Sign nuget pack
inputs:
command: 'custom'
arguments: 'sign $(nupkg_path)Heroes.Icons.*.nupkg -CertificatePath $(Agent.TempDirectory)\certificate -CertificatePassword $(cert_password) -Timestamper http://ts.ssl.com'
- task: NuGetCommand@2
displayName: Sign symbol pack
inputs:
command: 'custom'
arguments: 'sign $(nupkg_path)Heroes.Icons.*.snupkg -CertificatePath $(Agent.TempDirectory)\certificate -CertificatePassword $(cert_password) -Timestamper http://ts.ssl.com'
- powershell: |
$s = get-content $env:MAIN_PROJECT | select-string -pattern "<Version>"
$s -match "<Version>(?<content>.*)</Version>"
$m = $matches['content']
echo "##vso[task.setvariable variable=version]$m"
echo "Package version - $m"
displayName: Prep
- task: ArchiveFiles@2
displayName: Archive Release Files - Zip
inputs:
archiveType: 'zip'
rootFolderOrFile: '$(publish_any_path)'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)\Heroes.Icons.$(version).zip'
- task: ArchiveFiles@2
displayName: Archive Release Files - Tar
inputs:
archiveType: 'zip'
rootFolderOrFile: '$(publish_any_path)'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)\Heroes.Icons.$(version).tar.gz'
- task: PublishBuildArtifacts@1
displayName: Publish Artifacts - Release Files - Zip
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)\Heroes.Icons.$(version).zip'
artifactName: 'Heroes.Icons'
- task: PublishBuildArtifacts@1
displayName: Publish Artifacts - Release Files - Tar
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)\Heroes.Icons.$(version).tar.gz'
artifactName: 'Heroes.Icons'
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - Nuget
inputs:
pathtoPublish: '$(nupkg_path)'
artifactName: 'Heroes.Icons-Nuget'