Skip to content

Commit 32aeed6

Browse files
committed
Use ADO tasks instead of pwsh inline scripts
Also fix upload of artifacts to include everything.
1 parent 8e77a9e commit 32aeed6

File tree

1 file changed

+11
-37
lines changed

1 file changed

+11
-37
lines changed

.vsts-ci/templates/release-general.yml

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,23 @@
11
steps:
2-
- checkout: self
3-
4-
- powershell: |
5-
Write-Host "Installing pwsh..."
6-
if (Get-Command pwsh -ErrorAction Ignore)
7-
{
8-
Write-Host "pwsh already installed, skipping"
9-
return
10-
}
11-
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
12-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -outfile ./install-powershell.ps1
13-
./install-powershell.ps1 -Destination $powerShellPath
14-
$vstsCommandString = "vso[task.setvariable variable=PATH]$powerShellPath;$env:PATH"
15-
Write-Host "sending " + $vstsCommandString
16-
Write-Host "##$vstsCommandString"
17-
displayName: Install PowerShell Core
18-
19-
- pwsh: |
20-
Get-ChildItem -Path env:
21-
displayName: Capture environment
22-
condition: succeededOrFailed()
232

243
- task: DownloadBuildArtifacts@0
254
displayName: 'Download Build Artifacts'
265
inputs:
276
downloadType: specific
287

29-
# TODO: Use `ExtractFiles` task instead of script
30-
- task: PowerShell@1
31-
displayName: 'Extract build zip'
8+
- task: ExtractFiles@1
9+
displayName: 'Extract Build Zip'
3210
inputs:
33-
scriptType: inlineScript
34-
inlineScript: |
35-
$dest = New-Item -ItemType Directory $env:BUILD_ARTIFACTSTAGINGDIRECTORY/PowerShellEditorServices
36-
$psesZip = Get-ChildItem $env:BUILD_ARTIFACTSTAGINGDIRECTORY/PowerShellEditorServices-CI/PowerShellEditorServices*.zip -ErrorAction Stop
37-
$psesZip | Expand-Archive -DestinationPath $dest -Force -Verbose
38-
$psesZip | Remove-Item -Recurse -Force
11+
archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/PowerShellEditorServices-CI/PowerShellEditorServices*.zip'
12+
destinationFolder: '$(Build.ArtifactStagingDirectory)/PowerShellEditorServices'
3913

4014
- checkout: ComplianceRepo
15+
displayName: 'Checkout the ComplianceRepo'
4116

4217
- template: EsrpSign.yml@ComplianceRepo
4318
parameters:
19+
# NOTE: All artifacts are copied to "Signed" even though only some are
20+
# actually signed. We then publish this folder below.
4421
buildOutputPath: '$(Build.ArtifactStagingDirectory)/PowerShellEditorServices'
4522
signOutputPath: '$(Build.ArtifactStagingDirectory)/Signed'
4623
certificateId: 'CP-230012' # Authenticode certificate.
@@ -56,6 +33,10 @@ steps:
5633
# PowerShellEditorServices.VSCode Binary
5734
PowerShellEditorServices.VSCode/bin/Microsoft.PowerShell.EditorServices.VSCode.dll
5835
36+
- publish: $(Build.ArtifactStagingDirectory)/Signed
37+
artifact: PowerShellEditorServices
38+
displayName: 'Publish signed (and unsigned) artifacts'
39+
5940
# TODO: Use templates for compliance checks
6041
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
6142
displayName: 'Component Detection'
@@ -120,10 +101,3 @@ steps:
120101
uploadRoslyn: false
121102
uploadTSLint: false
122103
uploadAsync: true
123-
124-
# TODO: Use `publish` task instead of script
125-
- task: PowerShell@1
126-
displayName: 'Upload artifacts'
127-
inputs:
128-
scriptType: inlineScript
129-
inlineScript: 'Write-Host "##vso[artifact.upload containerfolder=PowerShellEditorServices;artifactname=PowerShellEditorServices]$(Build.ArtifactStagingDirectory)/Signed/PowerShellEditorServices"'

0 commit comments

Comments
 (0)