-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
97 lines (94 loc) · 3.08 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
pool:
vmImage: 'windows-2019'
variables:
- group: 'dotnet-config'
- group: 'github-config'
steps:
- checkout: self
persistCredentials: true
- task: DownloadSecureFile@1
displayName: 'Download Code Signing certificate'
name: Certificate
inputs:
secureFile: cert.pfx
- task: PowerShell@2
displayName: 'Calculate 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: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: sdk
version: 3.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: DotNetCoreCLI@2
displayName: 'Build'
inputs:
command: 'build'
projects: '*.sln'
arguments: '-c $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Publish'
inputs:
command: 'publish'
publishWebProjects: false
projects: '$(Build.SourcesDirectory)/src/*.csproj'
arguments: '-c $(BuildConfiguration)'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: 'Sign'
inputs:
targetType: 'inline'
script: |
$pswd = ConvertTo-SecureString $(CertificatePassword) -AsPlainText -Force
$cert = Get-PfxCertificate -FilePath $(Certificate.secureFilePath) -Password $pswd
Set-AuthenticodeSignature -FilePath $(Build.SourcesDirectory)/src/bin/$(BuildConfiguration)/netcoreapp3.1/publish/Ecf.Excel.dll -Certificate $cert -HashAlgorithm SHA256 -TimestampServer http://timestamp.digicert.com
pwsh: true
- task: ArchiveFiles@2
displayName: 'Create ZIP archive'
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/src/bin/$(BuildConfiguration)/netcoreapp3.1/publish'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/EcfExcel-$(SemVersion).zip'
replaceExistingArchive: true
- task: PowerShell@2
displayName: 'Push to GitHub'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
git remote add github https://$(PAT)@github.com/stuebersystems/ecf.excel.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: 'stuebersystems/ecf.excel'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
tagPattern: 'v-[1-9]*\S*'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'