|
| 1 | +parameters: |
| 2 | + - name: usePipelineArtifact |
| 3 | + type: boolean |
| 4 | + default: false |
| 5 | + |
1 | 6 | steps:
|
2 |
| - - pwsh: '$PSVersionTable' |
| 7 | +- pwsh: $PSVersionTable |
3 | 8 | displayName: PowerShell version
|
4 | 9 |
|
5 |
| - - pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))" |
6 |
| - displayName: Set Build Name for Non-PR |
7 |
| - condition: ne(variables['Build.Reason'], 'PullRequest') |
| 10 | +- checkout: self |
8 | 11 |
|
9 |
| - # TODO: Use a submodule or some such so we can actually track a version here. |
10 |
| - - pwsh: | |
11 |
| - git clone https://github.com/PowerShell/PowerShellEditorServices.git ../PowerShellEditorServices |
12 |
| - Install-Module InvokeBuild -Scope CurrentUser -Force |
13 |
| - Install-Module PlatyPS -Scope CurrentUser -Force |
14 |
| - New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell |
| 12 | +# NOTE: We either checkout the Git repo for PowerShellEditorServices, or we |
| 13 | +# download a pre-built artifact from the triggering pipeline and extract it to |
| 14 | +# the modules folder. In this way we do not accidentally build a release of the |
| 15 | +# server from this pipeline. |
| 16 | +- checkout: PowerShellEditorServices |
| 17 | + condition: not(${{ parameters.usePipelineArtifact }}) |
15 | 18 |
|
16 |
| - # Build |
17 |
| - - pwsh: Invoke-Build |
| 19 | +- task: DownloadPipelineArtifact@2 |
| 20 | + condition: ${{ parameters.usePipelineArtifact }} |
| 21 | + displayName: Download PowerShellEditorServices |
| 22 | + inputs: |
| 23 | + source: specific |
| 24 | + project: PowerShellEditorServices |
| 25 | + pipeline: 36 |
| 26 | + preferTriggeringPipeline: true |
| 27 | + allowPartiallySucceededBuilds: true |
| 28 | + artifact: PowerShellEditorServices |
18 | 29 |
|
19 |
| - - task: PublishTestResults@2 |
20 |
| - displayName: Publish test results |
21 |
| - inputs: |
22 |
| - testRunner: JUnit |
23 |
| - testResultsFiles: '**/test-results.xml' |
24 |
| - condition: succeededOrFailed() |
| 30 | +- task: ExtractFiles@1 |
| 31 | + condition: ${{ parameters.usePipelineArtifact }} |
| 32 | + displayName: Extract PowerShellEditorServices module |
| 33 | + inputs: |
| 34 | + archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip |
| 35 | + destinationFolder: $(Build.SourcesDirectory)/vscode-powershell/modules |
| 36 | + |
| 37 | +- pwsh: | |
| 38 | + Install-Module InvokeBuild -Scope CurrentUser -Force |
| 39 | + Invoke-Build |
| 40 | + Write-Host "##vso[task.setvariable variable=vsixPath]$(Resolve-Path powershell-*.vsix)" |
| 41 | + displayName: Build and test |
| 42 | + workingDirectory: $(Build.SourcesDirectory)/vscode-powershell |
25 | 43 |
|
26 |
| - - task: PublishBuildArtifacts@1 |
27 |
| - inputs: |
28 |
| - ArtifactName: vscode-powershell |
29 |
| - PathtoPublish: '$(Build.ArtifactStagingDirectory)/vscode-powershell' |
| 44 | +- publish: $(vsixPath) |
| 45 | + artifact: vscode-powershell-vsix-$(System.JobId) |
| 46 | + displayName: Publish extension artifact |
30 | 47 |
|
| 48 | +- publish: $(Build.SourcesDirectory)/vscode-powershell/scripts/Install-VSCode.ps1 |
| 49 | + artifact: vscode-powershell-unsigned-script-$(System.JobId) |
| 50 | + displayName: Publish unsigned script artifact |
| 51 | + |
| 52 | +- task: PublishTestResults@2 |
| 53 | + displayName: Publish test results |
| 54 | + inputs: |
| 55 | + testRunner: JUnit |
| 56 | + testResultsFiles: '**/test-results.xml' |
| 57 | + condition: succeededOrFailed() |
0 commit comments