1- name : TextUtility-Release-$(Build.BuildId)
2- trigger : none
1+ name : PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
32
4- pr :
3+ variables :
4+ # Don't download unneeded packages
5+ - name : DOTNET_SKIP_FIRST_TIME_EXPERIENCE
6+ value : ' true'
7+ # Improve performance by not sending telemetry
8+ - name : DOTNET_CLI_TELEMETRY_OPTOUT
9+ value : ' true'
10+
11+ trigger :
12+ batch : true
513 branches :
614 include :
7- - master
8- - release*
9-
10- variables :
11- DOTNET_CLI_TELEMETRY_OPTOUT : 1
12- POWERSHELL_TELEMETRY_OPTOUT : 1
15+ - master
16+ paths :
17+ exclude :
18+ - /.dependabot/*
19+ - /.poshchan/*
20+ - /.github/**/*
21+ - /.vscode/**/*
22+ - /.vsts-ci/misc-analysis.yml
23+ - /tools/**/*
24+ - .editorconfig
25+ - .gitattributes
26+ - .gitignore
27+ - /docs/**/*
28+ - /CHANGELOG.md
29+ - /CONTRIBUTING.md
30+ - /README.md
31+ - /LICENSE.txt
32+ - /CODE_OF_CONDUCT.md
1333
1434resources :
1535 repositories :
@@ -21,169 +41,70 @@ resources:
2141stages :
2242- stage : Build
2343 displayName : Build
24- pool :
25- name : Package ES CodeHub Lab E
2644 jobs :
27- - job : Build_Job
28- displayName : Build Microsoft.PowerShell.TextUtility
45+ - job : ' ReleaseBuild'
46+ displayName : Release Build
47+ pool :
48+ vmImage : ' vs2017-win2016'
49+ steps :
50+ - pwsh : |
51+ .\build.ps1 -Clean
52+ Remove-Item .\out\*.pdb
53+ displayName: Build
54+ - publish : " out/"
55+ artifact : out
56+ - job : ' SignBuild'
2957 variables :
3058 - group : ESRP
59+ displayName : Signing Build
60+ dependsOn : ' ReleaseBuild'
61+ pool :
62+ name : ' Package ES CodeHub Lab E'
63+ demands : DotNetFramework
3164 steps :
32- - checkout : self
33-
34- - pwsh : |
35- $versionString = if ($env:RELEASE_VERSION -eq 'fromBranch') {
36- $branch = $env:BUILD_SOURCEBRANCH
37- $branchOnly = $branch -replace '^refs/heads/'
38- $branchOnly -replace '^.*(release[-/])'
39- }
40- else {
41- $env:RELEASE_VERSION
42- }
43-
44- $nugetVersion = if ($versionString.StartsWith('v')) {
45- $versionString.Substring(1)
46- }
47- else {
48- $versionString
49- }
50-
51- $vstsCommandString = "vso[task.setvariable variable=Version]$nugetVersion"
52- Write-Verbose -Message "setting Version to $nugetVersion" -Verbose
53- Write-Host -Object "##$vstsCommandString"
54- displayName: Set NuGet package version variable
65+ - powershell : |
66+ Get-ChildItem -Path env:
67+ displayName: Capture environment
68+ condition: succeededOrFailed()
5569
56- - pwsh : |
57- $signSrcPath = "$(Build.SourcesDirectory)\TextUtility\tosign"
58- $null = New-Item -ItemType Directory -Path $signSrcPath
59- # Set signing src path variable
60- $vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}"
61- Write-Host "sending " + $vstsCommandString
62- Write-Host "##$vstsCommandString"
63-
64- $signOutPath = "$(Build.SourcesDirectory)\TextUtility\signed"
65- $null = New-Item -ItemType Directory -Path $signOutPath
66- # Set signing out path variable
67- $vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
68- Write-Host "sending " + $vstsCommandString
69- Write-Host "##$vstsCommandString"
70-
71- # Set path variable for guardian codesign validation
72- $vstsCommandString = "vso[task.setvariable variable=GDN_CODESIGN_TARGETDIRECTORY]${signOutPath}"
73- Write-Host "sending " + $vstsCommandString
74- Write-Host "##$vstsCommandString"
75-
76- $nugetSrcPath = "$(System.ArtifactsDirectory)/nuget"
77- $null = New-Item -ItemType Directory -Path $nugetSrcPath
78- # Set signing src path variable
79- $vstsCommandString = "vso[task.setvariable variable=nugetSrcPath]${nugetSrcPath}"
80- Write-Host "sending " + $vstsCommandString
81- Write-Host "##$vstsCommandString"
82-
83- $nugetOutPath = "$(System.ArtifactsDirectory)\nuget-signed"
84- $null = New-Item -ItemType Directory -Path $nugetOutPath
85- # Set signing out path variable
86- $vstsCommandString = "vso[task.setvariable variable=nugetOutPath]${nugetOutPath}"
87- Write-Host "sending " + $vstsCommandString
88- Write-Host "##$vstsCommandString"
89- displayName: Setup variables for signing
90-
91- - pwsh : |
92- ./TextUtility/build.ps1 -Clean -Configuration 'Release'
93- displayName: Execute build
94-
95- - publish : " $(Build.SourcesDirectory)\\ TextUtility\\ src\\ obj\\ project.assets.json"
96- artifact : AssetsJson
97- displayName : Publish project.assets.json
98-
99- - publish : " $(Build.SourcesDirectory)\\ TextUtility\\ out"
100- artifact : build
101- displayName : Publish build
102-
103- - pwsh : |
104- Copy-Item -Path "$(Build.SourcesDirectory)\TextUtility\out\Microsoft.PowerShell.TextUtility.dll" -Destination '$(signSrcPath)\' -Verbose -Force
105- displayName: Copy files to sign
106-
107- - pwsh : |
108- $excludeList = @('Microsoft.PowerShell.TextUtility.dll')
109- Copy-Item -Path "$(Build.SourcesDirectory)\TextUtility\out\*.dll" -Destination '$(signOutPath)' -Verbose -Exclude 'Microsoft.PowerShell.TextUtility.dll'
110- displayName: Copy pre-signed dependent assemblies
111-
112- - checkout : ComplianceRepo
70+ - task : DownloadPipelineArtifact@2
71+ displayName : ' Download Pipeline Artifacts'
72+ inputs :
73+ artifact : ' out'
74+ path : $(Build.SourcesDirectory)/out
11375
11476 - template : EsrpSign.yml@ComplianceRepo
11577 parameters :
11678 # the folder which contains the binaries to sign
117- buildOutputPath : $(signSrcPath)
79+ buildOutputPath : $(Build.SourcesDirectory)/out
11880 # the location to put the signed output
119- signOutputPath : $(signOutPath)
81+ signOutputPath : $(Build.SourcesDirectory)/Microsoft.PowerShell.TextUtility
12082 # the certificate ID to use
12183 certificateId : " CP-230012"
122- # the file pattern to use, comma separated
123- pattern : ' *.dll'
124-
125- - pwsh : |
126- Copy-Item -Path "$env:SIGNSRCPATH\*.dll" -Destination "$env:SIGNOUTPATH\" -recurse -verbose
127- displayName: Dummy copy to signed
128- condition: eq(variables['SkipSigning'], 'True')
129-
130- - publish : " $(SIGNOUTPATH)"
131- artifact : signed
132- displayName : Publish signed assembly
133-
134- - task : NuGetToolInstaller@1
135- displayName : ' Install NuGet.exe'
136-
84+ # The file pattern to use
85+ # If not using minimatch: comma separated, with * supported
86+ # If using minimatch: newline separated, with !, **, and * supported.
87+ # See link in the useMinimatch comments.
88+ pattern : ' Microsoft.PowerShell.*.dll,Microsoft.PowerShell.*.psd1,Microsoft.PowerShell.*.psm1'
89+ # decides if the task should use minimatch for the pattern matching.
90+ # https://github.com/isaacs/minimatch#features
91+ useMinimatch : false
92+
13793 - pwsh : |
138- $packageRootPath = '$(System.ArtifactsDirectory)/Microsoft.PowerShell.TextUtility'
139- $libPath = "$packageRootPath/lib/netstandard2.0"
140- $null = New-Item -ItemType Directory -Path $libPath -Force
141- Copy-Item -Path "$env:signOutPath\*.dll" -Destination $libPath -Verbose
142- Copy-Item -Path '$(Build.SourcesDirectory)/TextUtility/src/packaging/microsoft.powershell.TextUtility.nuspec' -Destination $packageRootPath -Verbose
143- Push-Location $packageRootPath
144- $version = "$env:VERSION"
145- Write-Verbose -Verbose "Creating NuGet package with version $version"
146- nuget.exe pack . -Version $version
94+ New-Item -Path $(Build.SourcesDirectory)/SignedZip -ItemType Directory
95+ Compress-Archive -Path $(Build.SourcesDirectory)/Microsoft.PowerShell.TextUtility -DestinationPath $(Build.SourcesDirectory)/SignedZip/Microsoft.PowerShell.TextUtility.zip
96+ displayName: 'Compress archive'
97+ condition: succeededOrFailed()
14798
148- if (-not (Test-Path "./Microsoft.PowerShell.TextUtility.$version.nupkg")) {
149- throw 'NuGet package not created.'
150- }
151- else {
152- Copy-Item "./Microsoft.PowerShell.TextUtility.$version.nupkg" -Destination '$(nugetSrcPath)' -Verbose -Force
153- }
154- displayName: Create NuGet Package
99+ - task : PublishPipelineArtifact@1
100+ inputs :
101+ targetpath : $(Build.SourcesDirectory)/Microsoft.PowerShell.TextUtility
102+ artifactName : Signed
155103
156- - publish : ' $(nugetSrcPath)/Microsoft.PowerShell.TextUtility.$(VERSION).nupkg'
157- artifact : unsigned-nuget
158- displayName : Publish nuget package
159-
160- - template : EsrpSign.yml@ComplianceRepo
161- parameters :
162- # the folder which contains the binaries to sign
163- buildOutputPath : $(nugetSrcPath)
164- # the location to put the signed output
165- signOutputPath : $(nugetOutPath)
166- # the certificate ID to use
167- certificateId : " CP-401405"
168- # the file pattern to use, comma separated
169- pattern : ' *.nupkg'
170-
171- - pwsh : |
172- Copy-Item -Path "$env:NUGETSRCPATH\*.nupkg" -Destination "$env:NUGETOUTPATH\" -recurse -verbose
173- displayName: Dummy nuget copy to signed
174- condition: and(succeeded(),eq(variables['SkipSigning'], 'True'))
175-
176- - pwsh : |
177- $version = "$env:VERSION"
178- $nugetPkgPath = Get-Item -Path "$env:NUGETOUTPATH/Microsoft.PowerShell.TextUtility.$version.nupkg"
179- $vstsCommandString = "vso[task.setvariable variable=nugetPkgPath]${nugetPkgPath}"
180- Write-Host "sending " + $vstsCommandString
181- Write-Host "##$vstsCommandString"
182- displayName: Set nuget package path
183-
184- - publish : ' $(NUGETPKGPATH)'
185- artifact : nuget
186- displayName : Publish nuget package
104+ - task : PublishPipelineArtifact@1
105+ inputs :
106+ targetpath : $(Build.SourcesDirectory)/SignedZip
107+ artifactName : SignedZip
187108
188109- stage : compliance
189110 displayName : Compliance
@@ -196,14 +117,10 @@ stages:
196117 - checkout : self
197118 - checkout : ComplianceRepo
198119 - download : current
199- artifact : build
200- - download : current
201- artifact : AssetsJson
120+ artifact : Signed
202121
203122 - pwsh : |
204- Get-ChildItem -Path "$(Pipeline.Workspace)\build" -Recurse
205-
206- Get-ChildItem -Path "$(Pipeline.Workspace)\AssetsJson" -Recurse
123+ Get-ChildItem -Path "$(Pipeline.Workspace)\Signed" -Recurse
207124 displayName: Capture downloaded artifacts
208125
209126 - template : assembly-module-compliance.yml@ComplianceRepo
@@ -212,25 +129,13 @@ stages:
212129 AnalyzeTarget : ' $(Pipeline.Workspace)\*.dll'
213130 AnalyzeSymPath : ' SRV*'
214131 # component-governance
215- sourceScanPath : ' $(Pipeline.Workspace)\AssetsJson '
132+ sourceScanPath : ' $(Build.SourcesDirectory) '
216133 # credscan
217134 suppressionsFile : ' '
218135 # TermCheck
219136 optionsRulesDBPath : ' '
220137 optionsFTPath : ' '
221138 # tsa-upload
222- codeBaseName : ' TextUtility_20201023 '
139+ codeBaseName : ' TextUtility_20201120 '
223140 # selections
224141 APIScan : false # set to false when not using Windows APIs.
225-
226- - template : template/publish.yml
227- parameters :
228- stageName : AzArtifactsFeed
229- environmentName : AzArtFeedApproval
230- feedUrl : ' https://pkgs.dev.azure.com/mscodehub/_packaging/pscore-release/nuget/v3/index.json'
231-
232- - template : template/publish.yml
233- parameters :
234- stageName : NuGet
235- environmentName : NugetFeedApproval
236- feedCredential : NugetOrgPush
0 commit comments