-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
151 lines (149 loc) · 5.32 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
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'
inputs:
APIKey: '$(SM_API_KEY)'
- task: PowerShell@2
displayName: 'Prepare DigiCert Code Signing'
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: '340e7a34-33ea-4418-8b72-d55dcb74efa7/dd1a6c3c-4e29-44c2-a80d-9d6c7004ac57'
- task: DotNetCoreCLI@2
displayName: 'Publish x64'
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src/SqlDocs.App.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/SqlDocs.App.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/SqlDocs.App.csproj'
arguments: '/p:PublishProfile=Portable /p:Version=$(SemVersion)'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: 'Sign EXE files'
env:
SM_CLIENT_CERT_FILE : $(SM_CLIENT_CERT_FILE.secureFilePath)
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/bin/Publish/win-x64/SqlDocs.exe
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/win-x86/SqlDocs.exe
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/portable/SqlDocs.exe
failOnStderr: true
pwsh: true
- task: DotNetCoreCLI@2
displayName: 'Build MSI Setup x64'
inputs:
command: 'build'
projects: 'setup/SqlDocs.Setup.wixproj'
arguments: '-c $(BuildConfiguration) -p:Platform=x64 -o $(Build.ArtifactStagingDirectory)'
- task: DotNetCoreCLI@2
displayName: 'Build MSI Setup x86'
inputs:
command: 'build'
projects: 'setup/SqlDocs.Setup.wixproj'
arguments: '-c $(BuildConfiguration) -p:Platform=x86 -o $(Build.ArtifactStagingDirectory)'
- task: ArchiveFiles@2
displayName: 'Create Zip for portable'
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/src/bin/Publish/portable/'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/sqldocs-portable.zip'
replaceExistingArchive: true
- task: PowerShell@2
displayName: 'Sign MSI files'
env:
SM_CLIENT_CERT_FILE : $(SM_CLIENT_CERT_FILE.secureFilePath)
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 "SQLDocs" $(Build.ArtifactStagingDirectory)/sqldocs-x64.msi
signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) /d "SQLDocs" $(Build.ArtifactStagingDirectory)/sqldocs-x86.msi
failOnStderr: true
pwsh: 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/openpotato/sqldocs.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: 'openpotato/sqldocs'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
title: '$(SemVersion) Release of SqlDocs'
addChangeLog: false