|
1 | | - trigger: |
2 | | - branches: |
3 | | - include: |
4 | | - - master |
5 | | - |
6 | | - pr: |
7 | | - branches: |
8 | | - exclude: |
9 | | - - '*' |
10 | | - |
11 | | - name: pr.$(prId)-$(prIteration) |
12 | | - |
13 | | - variables: |
14 | | - - group: Code_Signing_Certificate_2023_2026 |
15 | | - - name: prId |
16 | | - value: $[coalesce(variables['System.PullRequest.PullRequestId'], '000')] |
17 | | - - name: prIteration |
18 | | - value: $[counter(variables['prId'], 1)] |
19 | | - - name: buildConfiguration |
20 | | - value: Release |
21 | | - |
22 | | - stages: |
23 | | - - stage: BuildAndPublish |
24 | | - condition: succeeded() |
25 | | - jobs: |
26 | | - - job: BuildAndSign |
27 | | - pool: |
28 | | - vmImage: 'windows-latest' |
29 | | - |
30 | | - steps: |
31 | | - - checkout: self |
32 | | - fetchDepth: 0 |
33 | | - |
34 | | - - task: UseDotNet@2 |
35 | | - inputs: |
36 | | - packageType: 'sdk' |
37 | | - version: '9.x' |
38 | | - |
39 | | - - task: GitVersion@5 |
40 | | - inputs: |
41 | | - versionSpec: '5.x' |
42 | | - name: gitVersion |
43 | | - |
44 | | - - task: DownloadSecureFile@1 |
45 | | - name: cert |
46 | | - inputs: |
47 | | - secureFile: 'code-signing-certificate-2023-2026.pfx' |
48 | | - |
49 | | - - task: DotNetCoreCLI@2 |
50 | | - displayName: 'Build Project' |
51 | | - inputs: |
52 | | - command: 'build' |
53 | | - projects: 'Infragistics.QueryBuilder.Executor.csproj' |
54 | | - arguments: '-c $(buildConfiguration) /p:Version=$(GitVersion.NuGetVersionV2)' |
55 | | - workingDirectory: '$(Build.SourcesDirectory)' |
56 | | - |
57 | | - - powershell: | |
58 | | - $outputDir = "$(Build.SourcesDirectory)\bin\$(buildConfiguration)\net9.0" |
59 | | - Write-Host "Listing contents of: $outputDir" |
60 | | - if (-Not (Test-Path $outputDir)) { |
61 | | - Write-Error "Output folder not found: $outputDir" |
62 | | - exit 1 |
63 | | - } |
64 | | - Get-ChildItem $outputDir -Recurse | ForEach-Object { |
65 | | - Write-Host $_.FullName |
66 | | - } |
67 | | - displayName: 'Debug: List build output contents' |
68 | | -
|
69 | | - - powershell: | |
70 | | - $dllFolder = "$(Build.SourcesDirectory)\bin\$(buildConfiguration)\net9.0" |
71 | | - Write-Host "Signing DLLs in folder: $dllFolder" |
72 | | -
|
73 | | - $signtoolPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe" |
74 | | - Write-Host "Using signtool at: $signtoolPath" |
75 | | -
|
76 | | - $dllFiles = Get-ChildItem -Path $dllFolder -Filter *.dll -Recurse |
77 | | - foreach ($dll in $dllFiles) { |
78 | | - Write-Host "Signing $($dll.FullName)..." |
79 | | - & $signtoolPath sign /f $(cert.secureFilePath) /p $env:CERT_PASS /tr $(SigningCertificateTimestampUrl) /td sha256 /fd sha256 $dll.FullName |
80 | | -
|
81 | | - if ($LASTEXITCODE -ne 0) { |
82 | | - Write-Error "Signing failed for $($dll.FullName)" |
83 | | - exit 1 |
84 | | - } |
85 | | - } |
86 | | - displayName: 'Sign all DLL files with PFX certificate' |
87 | | - env: |
88 | | - CERT_PASS: $(SigningCertificatePassword) |
89 | | -
|
90 | | - - powershell: | |
91 | | - $packageOutputDir = "$(Build.ArtifactStagingDirectory)\nuget" |
92 | | - $packageVersion = "$(GitVersion.NuGetVersionV2)" |
93 | | -
|
94 | | - Write-Host "Packing project from existing build output..." |
95 | | - dotnet pack ./Infragistics.QueryBuilder.Executor.csproj ` |
96 | | - --no-build ` |
97 | | - --configuration $(buildConfiguration) ` |
98 | | - -p:PackageVersion=$packageVersion ` |
99 | | - -o $packageOutputDir |
| 1 | +trigger: |
| 2 | + tags: |
| 3 | + include: |
| 4 | + - '*' |
| 5 | +# This pipeline is meant to build & deploy upon tagging. It's not meant to be a part of PR validation. |
| 6 | +pr: none |
| 7 | + |
| 8 | +name: pr.$(prId)-$(prIteration) |
| 9 | + |
| 10 | +variables: |
| 11 | +- group: Code_Signing_Certificate_2023_2026 |
| 12 | +- name: prId |
| 13 | + value: $[coalesce(variables['System.PullRequest.PullRequestId'], '000')] |
| 14 | +- name: prIteration |
| 15 | + value: $[counter(variables['prId'], 1)] |
| 16 | +- name: buildConfiguration |
| 17 | + value: Release |
| 18 | + |
| 19 | +stages: |
| 20 | +- stage: BuildAndPublish |
| 21 | + condition: succeeded() |
| 22 | + jobs: |
| 23 | + - job: BuildAndSign |
| 24 | + pool: |
| 25 | + vmImage: 'windows-latest' |
| 26 | + |
| 27 | + steps: |
| 28 | + - checkout: self |
| 29 | + fetchDepth: 0 |
| 30 | + |
| 31 | + - task: UseDotNet@2 |
| 32 | + inputs: |
| 33 | + packageType: 'sdk' |
| 34 | + version: '9.x' |
| 35 | + |
| 36 | + - task: GitVersion@5 |
| 37 | + inputs: |
| 38 | + versionSpec: '5.x' |
| 39 | + name: gitVersion |
| 40 | + |
| 41 | + - task: DownloadSecureFile@1 |
| 42 | + name: cert |
| 43 | + inputs: |
| 44 | + secureFile: 'code-signing-certificate-2023-2026.pfx' |
| 45 | + |
| 46 | + - task: DotNetCoreCLI@2 |
| 47 | + displayName: 'Build Project' |
| 48 | + inputs: |
| 49 | + command: 'build' |
| 50 | + projects: 'Infragistics.QueryBuilder.Executor.csproj' |
| 51 | + arguments: '-c $(buildConfiguration) /p:Version=$(GitVersion.NuGetVersionV2)' |
| 52 | + workingDirectory: '$(Build.SourcesDirectory)' |
| 53 | + |
| 54 | + - powershell: | |
| 55 | + $outputDir = "$(Build.SourcesDirectory)\bin\$(buildConfiguration)\net9.0" |
| 56 | + Write-Host "Listing contents of: $outputDir" |
| 57 | + if (-Not (Test-Path $outputDir)) { |
| 58 | + Write-Error "Output folder not found: $outputDir" |
| 59 | + exit 1 |
| 60 | + } |
| 61 | + Get-ChildItem $outputDir -Recurse | ForEach-Object { |
| 62 | + Write-Host $_.FullName |
| 63 | + } |
| 64 | + displayName: 'Debug: List build output contents' |
| 65 | +
|
| 66 | + - powershell: | |
| 67 | + $dllFolder = "$(Build.SourcesDirectory)\bin\$(buildConfiguration)\net9.0" |
| 68 | + Write-Host "Signing DLLs in folder: $dllFolder" |
| 69 | +
|
| 70 | + $signtoolPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe" |
| 71 | + Write-Host "Using signtool at: $signtoolPath" |
| 72 | +
|
| 73 | + $dllFiles = Get-ChildItem -Path $dllFolder -Filter *.dll -Recurse |
| 74 | + foreach ($dll in $dllFiles) { |
| 75 | + Write-Host "Signing $($dll.FullName)..." |
| 76 | + & $signtoolPath sign /f $(cert.secureFilePath) /p $env:CERT_PASS /tr $(SigningCertificateTimestampUrl) /td sha256 /fd sha256 $dll.FullName |
100 | 77 |
|
101 | 78 | if ($LASTEXITCODE -ne 0) { |
102 | | - Write-Error "dotnet pack failed" |
| 79 | + Write-Error "Signing failed for $($dll.FullName)" |
103 | 80 | exit 1 |
104 | | - } |
105 | | - displayName: 'Pack NuGet Package using PowerShell' |
106 | | -
|
107 | | - - task: PowerShell@2 |
108 | | - displayName: 'Sign NuGet package' |
109 | | - env: |
110 | | - CERT_PASS: $(SigningCertificatePassword) |
111 | | - inputs: |
112 | | - targetType: 'inline' |
113 | | - script: | |
114 | | - nuget.exe sign $(Build.ArtifactStagingDirectory)\nuget\*.nupkg -CertificatePath $(cert.secureFilePath) -CertificatePassword $env:CERT_PASS -Timestamper $(SigningCertificateTimestampUrl) |
115 | | -
|
116 | | - - task: PublishBuildArtifacts@1 |
117 | | - inputs: |
118 | | - PathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget' |
119 | | - ArtifactName: 'NuGetPackage' |
120 | | - publishLocation: 'Container' |
121 | | - displayName: 'Publish NuGet Package as Build Artifact' |
122 | | - |
123 | | - # - task: NuGetCommand@2 |
124 | | - # inputs: |
125 | | - # command: 'push' |
126 | | - # packagesToPush: '$(Build.ArtifactStagingDirectory)/nuget/*.nupkg' |
127 | | - # nuGetFeedType: 'external' |
128 | | - # publishFeedCredentials: 'NuGet' |
129 | | - # displayName: 'Publish to NuGet.org' |
| 81 | + } |
| 82 | + } |
| 83 | + displayName: 'Sign all DLL files with PFX certificate' |
| 84 | + env: |
| 85 | + CERT_PASS: $(SigningCertificatePassword) |
| 86 | +
|
| 87 | + - powershell: | |
| 88 | + $packageOutputDir = "$(Build.ArtifactStagingDirectory)\nuget" |
| 89 | + $packageVersion = "$(GitVersion.NuGetVersionV2)" |
| 90 | +
|
| 91 | + Write-Host "Packing project from existing build output..." |
| 92 | + dotnet pack ./Infragistics.QueryBuilder.Executor.csproj ` |
| 93 | + --no-build ` |
| 94 | + --configuration $(buildConfiguration) ` |
| 95 | + -p:PackageVersion=$packageVersion ` |
| 96 | + -o $packageOutputDir |
| 97 | +
|
| 98 | + if ($LASTEXITCODE -ne 0) { |
| 99 | + Write-Error "dotnet pack failed" |
| 100 | + exit 1 |
| 101 | + } |
| 102 | + displayName: 'Pack NuGet Package using PowerShell' |
| 103 | +
|
| 104 | + - task: PowerShell@2 |
| 105 | + displayName: 'Sign NuGet package' |
| 106 | + env: |
| 107 | + CERT_PASS: $(SigningCertificatePassword) |
| 108 | + inputs: |
| 109 | + targetType: 'inline' |
| 110 | + script: | |
| 111 | + nuget.exe sign $(Build.ArtifactStagingDirectory)\nuget\*.nupkg -CertificatePath $(cert.secureFilePath) -CertificatePassword $env:CERT_PASS -Timestamper $(SigningCertificateTimestampUrl) |
| 112 | +
|
| 113 | + - task: PublishBuildArtifacts@1 |
| 114 | + inputs: |
| 115 | + PathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget' |
| 116 | + ArtifactName: 'NuGetPackage' |
| 117 | + publishLocation: 'Container' |
| 118 | + displayName: 'Publish NuGet Package as Build Artifact' |
| 119 | + |
| 120 | + # - task: NuGetCommand@2 |
| 121 | + # inputs: |
| 122 | + # command: 'push' |
| 123 | + # packagesToPush: '$(Build.ArtifactStagingDirectory)/nuget/*.nupkg' |
| 124 | + # nuGetFeedType: 'external' |
| 125 | + # publishFeedCredentials: 'NuGet' |
| 126 | + # displayName: 'Publish to NuGet.org' |
0 commit comments