-
Notifications
You must be signed in to change notification settings - Fork 545
Expand file tree
/
Copy pathvscode-powershell-OneBranch.yml
More file actions
186 lines (180 loc) · 8.05 KB
/
vscode-powershell-OneBranch.yml
File metadata and controls
186 lines (180 loc) · 8.05 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#################################################################################
# OneBranch Pipelines #
# This pipeline was created by EasyStart from a sample located at: #
# https://aka.ms/obpipelines/easystart/samples #
# Documentation: https://aka.ms/obpipelines #
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
# Retail Tasks: https://aka.ms/obpipelines/tasks #
# Support: https://aka.ms/onebranchsup #
#################################################################################
trigger:
- main
schedules:
- cron: "25 9 * * 3"
displayName: Weekly CodeQL
branches:
include:
- main
always: true
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
parameters:
- name: debug
displayName: Enable debug output
type: boolean
default: false
- name: OfficialBuild
displayName: Use Official OneBranch template
type: boolean
default: false
variables:
system.debug: ${{ parameters.debug }}
BuildConfiguration: Release
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
OneBranchTemplate: ${{ iif(parameters.OfficialBuild, 'v2/OneBranch.Official.CrossPlat.yml@templates', 'v2/OneBranch.NonOfficial.CrossPlat.yml@templates') }}
extends:
# https://aka.ms/obpipelines/templates
template: ${{ variables.OneBranchTemplate }}
parameters:
globalSdl: # https://aka.ms/obpipelines/sdl
asyncSdl:
enabled: true
forStages: [build]
featureFlags:
EnableCDPxPAT: false
WindowsHostVersion:
Version: 2022
release:
category: NonAzure
stages:
- stage: build
jobs:
- job: main
displayName: Build package
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
ob_sdl_codeSignValidation_excludes: -|**\*.js # Node.js JavaScript signatures are not supported
steps:
- pwsh: |
$version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
Write-Output "##vso[task.setvariable variable=vsixVersion;isOutput=true]$version"
$prerelease = ([semver]$version).Minor % 2 -ne 0
if ($prerelease) { $version += "-preview" }
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$prerelease"
name: package
displayName: Get version from package.json
- task: onebranch.pipeline.version@1
displayName: Set OneBranch version
inputs:
system: Custom
customVersion: $(package.version)
- task: DownloadPipelineArtifact@2
displayName: Download Official PowerShellEditorServices
inputs:
source: specific
project: One
definition: 433526
allowPartiallySucceededBuilds: true
buildVersionToDownload: latestFromBranch
tags: onebranch_build_type_official
branchName: refs/heads/main
artifact: drop_build_main
- task: ExtractFiles@1
displayName: Extract PowerShellEditorServices
inputs:
archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip
destinationFolder: $(Build.SourcesDirectory)/modules
- pwsh: |
$manifest = Test-ModuleManifest $(Build.SourcesDirectory)/modules/PowerShellEditorServices/PowerShellEditorServices.psd1
Write-Host Using PowerShellEditorServices v$($manifest.Version)
displayName: PowerShellEditorServices version
- pwsh: ./tools/installPSResources.ps1 -PSRepository CFS
displayName: Install PSResources
- pwsh: Invoke-Build Test -Configuration $(BuildConfiguration)
displayName: Build and test
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party example PowerShell files
inputs:
command: sign
signing_profile: external_distribution
search_root: $(Build.SourcesDirectory)/examples
files_to_sign: "**/*.ps1;**/*.psd1;**/*.psm1"
- pwsh: Invoke-Build Package
displayName: Create package
- pwsh: |
npx vsce generate-manifest --packagePath out/powershell-$(package.vsixVersion).vsix
cp out/powershell-$(package.vsixVersion).manifest out/powershell-$(package.vsixVersion).signature.p7s
displayName: Generate VSIX manifest
- task: onebranch.pipeline.signing@1
displayName: Sign VSIX manifest
inputs:
command: sign
cp_code: "CP-401405-VSCodePublisherSign"
search_root: $(Build.SourcesDirectory)/out
files_to_sign: "*.signature.p7s"
- stage: release
dependsOn: build
condition: and(succeeded(), ${{ eq(parameters.OfficialBuild, true) }})
variables:
ob_release_environment: ${{ iif(parameters.OfficialBuild, 'Production', 'Test') }}
version: $[ stageDependencies.build.main.outputs['package.version'] ]
vsixVersion: $[ stageDependencies.build.main.outputs['package.vsixVersion'] ]
prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ]
jobs:
- job: github
displayName: Publish draft to GitHub
pool:
type: release
templateContext:
inputs:
- input: pipelineArtifact
artifactName: drop_build_main
steps:
- task: GitHubRelease@1
displayName: Create GitHub release
inputs:
gitHubConnection: github.com_andyleejordan
repositoryName: PowerShell/vscode-powershell
target: main
assets: |
$(Pipeline.Workspace)/powershell-$(vsixVersion).vsix
$(Pipeline.Workspace)/powershell-$(vsixVersion).manifest
$(Pipeline.Workspace)/powershell-$(vsixVersion).signature.p7s
tagSource: userSpecifiedTag
tag: v$(version)
isDraft: true
isPreRelease: $(prerelease)
addChangeLog: false
releaseNotesSource: inline
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"
- job: vscode
displayName: Publish to VS Code Marketplace
pool:
type: release
templateContext:
inputs:
- input: pipelineArtifact
artifactName: drop_build_main
workflow: vsce
vsce:
serviceConnection: powershell-vscode-marketplace
vsixPath: "$(Pipeline.Workspace)/powershell-$(vsixVersion).vsix"
signaturePath: "$(Pipeline.Workspace)/powershell-$(vsixVersion).signature.p7s"
manifestPath: "$(Pipeline.Workspace)/powershell-$(vsixVersion).manifest"
preRelease: $(prerelease)
useCustomVSCE: true
feed:
organization: msazure
project: One
feedName: vsce
steps:
- pwsh: |
Write-Host Publishing: $(vsixVersion), pre-release: $(prerelease)
displayName: No-op step to satisfy pipeline requirements