-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
170 lines (168 loc) · 6.87 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
pool:
vmImage: 'windows-2022'
variables:
- group: 'code-sign-config'
- group: 'dotnet-config'
- group: 'github-config'
steps:
- checkout: self
persistCredentials: true
- task: DownloadSecureFile@1
displayName: 'Download Client Authentication Certificate'
name: SM_CLIENT_CERT_FILE
inputs:
secureFile: ClientCert.p12
- task: SSMClientToolsSetup@1
displayName: 'Setup DigiCert Tools'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
APIKey: '$(SM_API_KEY)'
- task: PowerShell@2
displayName: 'Prepare DigiCert Code Signing'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
$env:PATH += ';C:\Program Files\DigiCert\DigiCert Keylocker Tools'
smctl credentials save $(SM_API_KEY) $(SM_CLIENT_CERT_PASSWORD)
smksp_cert_sync.exe
failOnStderr: true
pwsh: true
- task: PowerShell@2
displayName: 'Get Version Number'
inputs:
filePath: 'azure-gitversion.ps1'
failOnStderr: true
pwsh: true
- task: Assembly-Info-NetCore@2
displayName: 'Apply Assembly Infos'
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: '**/*.csproj'
InsertAttributes: true
FileEncoding: 'auto'
WriteBOM: false
VersionNumber: '$(MajorVersion).$(MinorVersion).$(PatchVersion).$(Build.BuildId)'
FileVersionNumber: '$(MajorVersion).$(MinorVersion).$(PatchVersion).$(Build.BuildId)'
InformationalVersion: '$(SemVersion)'
LogLevel: 'verbose'
FailOnWarning: false
- task: DotNetCoreCLI@2
displayName: 'Restore'
inputs:
command: 'restore'
projects: '*.sln'
feedsToUse: 'select'
vstsFeed: 'b0890edd-bcca-4a1c-b63c-d22daf6e4407/24f47e68-5eca-4ba8-8ab3-905662347d75'
- task: DotNetCoreCLI@2
displayName: 'Publish x64'
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enbrea.Cli/Enbrea.Cli.csproj'
arguments: '/p:PublishProfile=x64 /p:Version=$(SemVersion)'
zipAfterPublish: false
modifyOutputPath: false
- task: DotNetCoreCLI@2
displayName: 'Publish x86'
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enbrea.Cli/Enbrea.Cli.csproj'
arguments: '/p:PublishProfile=x86 /p:Version=$(SemVersion)'
zipAfterPublish: false
modifyOutputPath: false
- task: DotNetCoreCLI@2
displayName: 'Publish portable'
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/Enbrea.Cli/Enbrea.Cli.csproj'
arguments: '/p:PublishProfile=Portable /p:Version=$(SemVersion)'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: 'Sign EXE files'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
env:
SM_CLIENT_CERT_FILE : $(SM_CLIENT_CERT_FILE.secureFilePath)
SM_HOST : $(SM_HOST)
inputs:
targetType: 'inline'
script: |
$env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64'
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/Enbrea.Cli/bin/Publish/win-x64/Enbrea.exe
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/Enbrea.Cli/bin/Publish/win-x86/Enbrea.exe
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/Enbrea.Cli/bin/Publish/portable/Enbrea.exe
failOnStderr: true
pwsh: true
- task: DotNetCoreCLI@2
displayName: 'Build MSI Setup x64'
inputs:
command: 'build'
projects: 'setup/Enbrea.Cli.Setup.wixproj'
arguments: '-c $(BuildConfiguration) -p:Platform=x64'
- task: DotNetCoreCLI@2
displayName: 'Build MSI Setup x86'
inputs:
command: 'build'
projects: 'setup/Enbrea.Cli.Setup.wixproj'
arguments: '-c $(BuildConfiguration) -p:Platform=x86'
- task: PowerShell@2
displayName: 'Copy MSI files'
inputs:
targetType: 'inline'
script: |
Copy-Item -Path $(Build.SourcesDirectory)/setup/bin/x64/Release/de-DE/enbrea.cli-x64.msi -Destination $(Build.ArtifactStagingDirectory)/enbrea.cli-x64-de.msi
Copy-Item -Path $(Build.SourcesDirectory)/setup/bin/x64/Release/en-US/enbrea.cli-x64.msi -Destination $(Build.ArtifactStagingDirectory)/enbrea.cli-x64-en.msi
Copy-Item -Path $(Build.SourcesDirectory)/setup/bin/x86/Release/de-DE/enbrea.cli-x86.msi -Destination $(Build.ArtifactStagingDirectory)/enbrea.cli-x86-de.msi
Copy-Item -Path $(Build.SourcesDirectory)/setup/bin/x86/Release/en-US/enbrea.cli-x86.msi -Destination $(Build.ArtifactStagingDirectory)/enbrea.cli-x86-en.msi
failOnStderr: true
pwsh: true
- task: PowerShell@2
displayName: 'Sign MSI files'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
env:
SM_CLIENT_CERT_FILE : $(SM_CLIENT_CERT_FILE.secureFilePath)
SM_HOST : $(SM_HOST)
inputs:
targetType: 'inline'
script: |
$env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64'
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) /d "Enbrea CLI" $(Build.ArtifactStagingDirectory)/enbrea.cli-x64-de.msi
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) /d "Enbrea CLI" $(Build.ArtifactStagingDirectory)/enbrea.cli-x64-en.msi
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) /d "Enbrea CLI" $(Build.ArtifactStagingDirectory)/enbrea.cli-x86-de.msi
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) /d "Enbrea CLI" $(Build.ArtifactStagingDirectory)/enbrea.cli-x86-en.msi
failOnStderr: true
pwsh: true
- task: ArchiveFiles@2
displayName: 'Create Zip for portable'
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/src/Enbrea.Cli/bin/Publish/portable/'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/enbrea.cli-portable.zip'
replaceExistingArchive: true
- task: PowerShell@2
displayName: 'Push code to GitHub'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
git remote add github https://$(PAT)@github.com/enbrea/enbrea.cli.git
git fetch github
git checkout .
git push github HEAD:main
git push --tags github HEAD:main
pwsh: true
- task: GitHubRelease@1
displayName: 'Create GitHub Release'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
gitHubConnection: 'stuebersystems'
repositoryName: 'enbrea/enbrea.cli'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
title: '$(SemVersion) Release of Enbrea CLI'
addChangeLog: false