-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yml
136 lines (116 loc) · 3.71 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
131
132
133
134
135
136
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
batch: true
branches:
include:
- main
pr: none
pool:
vmImage: windows-latest
variables:
- group: Signing
- name: solution
value: 'Community.VisualStudio.VSCT.sln'
- name: buildPlatform
value: 'Any CPU'
- name: buildConfiguration
value: 'Release'
- name: buildMachine
value: '$(Agent.MachineName)'
- name: buildUser
value: '$(Build.QueuedBy)'
steps:
- checkout: self
clean: true
submodules: true
persistCredentials: true
- powershell: 'Write-Host ("##vso[task.setvariable variable=MSBuildEmitSolution;]0")'
displayName: 'Ensure MSBuildEmitSolution is not set'
- task: DownloadSecureFile@1
displayName: 'Download secure file PFX'
name: app_pfx
inputs:
secureFile: 'Cloud3D-codesign.pfx'
- task: DownloadSecureFile@1
displayName: 'Download secure file SNK'
name: snk
inputs:
secureFile: 'Cloud3D-codesign.snk'
- task: PowerShell@2
displayName: 'Install Cert'
inputs:
targetType: filePath
filePath: 'InstallCert.ps1'
arguments: '-pfxpath $(app_pfx.secureFilePath) -password $(pfx_password)'
- task: NuGetToolInstaller@0
inputs:
versionSpec: 5.8.1
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'config'
includeNugetOrg: 'true'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
clean: true
msbuildArgs: '/p:PackageOutputPath="$(Build.ArtifactStagingDirectory)" /p:BuildUser="$(buildUser)" /p:BuildMachine="$(buildMachine)" /p:AssemblyOriginatorKeyFile="$(snk.secureFilePath)" /p:PublicRelease=true'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
- task: PowerShell@2
displayName: 'Detect packages'
inputs:
targetType: inline
script: |
$dir = $env:BUILD_ARTIFACTSTAGINGDIRECTORY + "\*.nupkg"
Write-Host "Package Directory: $dir"
$packages = Get-ChildItem -Path $dir -Recurse
$ids = $packages | Select-Object -ExpandProperty name
Write-Host "Packages: $ids"
Write-Host "Package Count: $($packages.Count)"
Write-Host ("##vso[task.setvariable variable=package_count;]$($packages.Count)")
- task: NuGetCommand@2
condition: and(succeeded(), ne(variables['package_count'],0))
displayName: 'NuGet Sign'
inputs:
command: custom
arguments: 'sign $(Build.ArtifactStagingDirectory)\*.nupkg -Timestamper $(timestamper) -CertificateFingerprint $(app_pfx_thumbprint)'
- task: NuGetCommand@2
displayName: Push Nuget Packages to nuget.org
inputs:
command: 'push'
feedsToUse: 'config'
includeNugetOrg: 'true'
publishFeedCredentials: 'NuGet.org'
externalFeedCredentials: 'NuGet.org'
packagesToPush: $(Build.ArtifactStagingDirectory)\*.nupkg
verbosityPush: 'Detailed'
nuGetFeedType: 'external'
- powershell: |
Write-Host "Tagging Build: $env:BuildNumber"
git tag $env:BuildNumber
git push origin $env:BuildNumber
env:
BuildNumber: $(Build.BuildNumber)
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
- task: GithubRelease@0
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: github-czemacleod
repositoryName: VsixCommunity/Community.VisualStudio.VSCT
assets: $(Build.ArtifactStagingDirectory)/*.nupkg
addChangeLog: true
- task: PowerShell@2
displayName: 'Remove Cert'
inputs:
targetType: filePath
filePath: 'RemoveCert.ps1'
arguments: '-pfxpath $(app_pfx.secureFilePath) -password $(pfx_password)'
condition: always()