-
Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathPowerShellEditorServices-Official.yml
173 lines (167 loc) · 6.58 KB
/
PowerShellEditorServices-Official.yml
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
#################################################################################
# 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: '35 13 * * 4'
displayName: Weekly CodeQL
branches:
include:
- main
always: true
parameters:
- name: debug
displayName: Enable debug output
type: boolean
default: false
variables:
system.debug: ${{ parameters.debug }}
BuildConfiguration: Release
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
extends:
# https://aka.ms/obpipelines/templates
template: v2/OneBranch.Official.CrossPlat.yml@templates
parameters:
globalSdl: # https://aka.ms/obpipelines/sdl
asyncSdl:
enabled: true
forStages: [build]
featureFlags:
EnableCDPxPAT: false
WindowsHostVersion:
Version: 2022
Network: KS3
release:
category: NonAzure
stages:
- stage: build
jobs:
- job: main
displayName: Build package
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- pwsh: |
[xml]$xml = Get-Content PowerShellEditorServices.Common.props
$version = $xml.Project.PropertyGroup.VersionPrefix
$prerelease = $xml.Project.PropertyGroup.VersionSuffix
if ($prerelease) { $version += "-$prerelease" }
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$(-not [string]::IsNullOrEmpty($prerelease))"
name: package
displayName: Get version from project properties
- task: onebranch.pipeline.version@1
displayName: Set OneBranch version
inputs:
system: Custom
customVersion: $(package.version)
- task: UseDotNet@2
displayName: Use .NET 8.x SDK
inputs:
packageType: sdk
useGlobalJson: true
- task: UseDotNet@2
displayName: Use .NET 6.x runtime (for tests)
inputs:
packageType: runtime
version: 6.x
- pwsh: |
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet
./tools/installPSResources.ps1 -PSRepository CFS
displayName: Install PSResources
- pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS
displayName: Build and test
- task: PublishTestResults@2
displayName: Publish test results
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
failTaskOnFailedTests: true
- pwsh: |
$assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices/bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll")
if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) {
Write-Host "##vso[task.LogIssue type=error;]Was not built in release configuration!"
exit 1
}
displayName: Assert release configuration
continueOnError: true
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party files
inputs:
command: sign
signing_profile: external_distribution
search_root: $(Build.SourcesDirectory)/module
files_to_sign: |
**/*.ps1;
**/*.psd1;
**/*.psm1;
**/*.ps1xml;
**/Microsoft.PowerShell.EditorServices*.dll;
- task: onebranch.pipeline.signing@1
displayName: Sign 3rd-party files
inputs:
command: sign
signing_profile: 135020002
search_root: $(Build.SourcesDirectory)/module
files_to_sign: |
**/MediatR.dll;
**/Nerdbank.Streams.dll;
**/Newtonsoft.Json.dll;
**/OmniSharp.Extensions*.dll;
**/System.Reactive.dll;
- task: ArchiveFiles@2
displayName: Zip signed artifacts
inputs:
rootFolderOrFile: $(Build.SourcesDirectory)/module
includeRootFolder: false
archiveType: zip
archiveFile: out/PowerShellEditorServices.zip
- stage: release
dependsOn: build
condition: eq(variables['Build.Reason'], 'Manual')
variables:
ob_release_environment: Production
version: $[ stageDependencies.build.main.outputs['package.version'] ]
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
repositoryName: PowerShell/PowerShellEditorServices
target: main
assets: $(Pipeline.Workspace)/PowerShellEditorServices.zip
tagSource: userSpecifiedTag
tag: v$(version)
isDraft: true
isPreRelease: $(prerelease)
addChangeLog: false
releaseNotesSource: inline
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"