-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
110 lines (108 loc) · 3.64 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
pool:
vmImage: 'windows-2022'
variables:
- group: 'code-sign-config'
- group: 'nuget-package-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
- 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: 'Build'
inputs:
command: 'build'
projects: '*.sln'
arguments: '-c $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Test'
inputs:
command: 'test'
projects: '*.sln'
arguments: '-c $(BuildConfiguration)'
testRunTitle: 'Perform unit tests'
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: 'custom'
projects: 'src/Enbrea.Untis.Gpu.csproj'
custom: 'pack'
arguments: '/p:Configuration=$(BuildConfiguration) /p:PackageVersion=$(SemVersion) --no-build'
- task: NuGetCommand@2
displayName: 'Sign'
env:
SM_CLIENT_CERT_FILE : $(SM_CLIENT_CERT_FILE.secureFilePath)
inputs:
command: 'custom'
arguments: 'sign $(Build.Repository.LocalPath)/**/*.nupkg -Timestamper http://timestamp.digicert.com -CertificateFingerprint $(SM_CERT_FINGERPRINT) -HashAlgorithm SHA256 -Verbosity detailed -Overwrite'
- task: NuGetCommand@2
displayName: 'Publish preview to internal feed'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
command: 'push'
packagesToPush: '$(Build.Repository.LocalPath)/**/*.nupkg;!$(Build.Repository.LocalPath)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'b0890edd-bcca-4a1c-b63c-d22daf6e4407/24f47e68-5eca-4ba8-8ab3-905662347d75'
- 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/enbrea/enbrea.untis.gpu.git
git fetch github
git checkout .
git push github HEAD:main
git push --tags github HEAD:main
pwsh: true
- task: NuGetCommand@2
displayName: 'Publish to nuget.org'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
command: 'push'
packagesToPush: '$(Build.Repository.LocalPath)/**/*.nupkg;!$(Build.Repository.LocalPath)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'STUEBER SYSTEMS | nuget.org'