Skip to content

Commit 20f90a9

Browse files
committed
Support 'preview' in version and always publish (a draft)
Removed the manual validation step because it is unnecesary (and annoying) to gate this pipeline since it opens an unpublished, draft release. The downstream triggered pipeline will gate the release to the VS Code marketplace.
1 parent db3d833 commit 20f90a9

File tree

3 files changed

+32
-46
lines changed

3 files changed

+32
-46
lines changed

.github/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ changelog:
33
labels:
44
- Ignore
55
authors:
6-
- dependabot[bot]
6+
- dependabot
77
categories:
88
- title: Enhancements & Features ✨
99
labels:

.pipelines/PowerShellEditorServices-Official.yml

+17-33
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ extends:
5252
- pwsh: |
5353
[xml]$xml = Get-Content PowerShellEditorServices.Common.props
5454
$version = $xml.Project.PropertyGroup.VersionPrefix
55+
$prerelease = $xml.Project.PropertyGroup.VersionSuffix
56+
if ($prerelease) { $version += "-$prerelease" }
5557
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
58+
Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$(-not [string]::IsNullOrEmpty($prerelease))"
5659
name: package
5760
displayName: Get version from project properties
5861
- task: onebranch.pipeline.version@1
@@ -61,17 +64,17 @@ extends:
6164
system: Custom
6265
customVersion: $(package.version)
6366
- task: UseDotNet@2
64-
displayName: Install .NET 8.x SDK
67+
displayName: Use .NET 8.x SDK
6568
inputs:
6669
packageType: sdk
6770
version: 8.x
6871
- task: UseDotNet@2
69-
displayName: Install .NET 7.x runtime
72+
displayName: Use .NET 7.x runtime (for tests)
7073
inputs:
7174
packageType: runtime
7275
version: 7.x
7376
- task: UseDotNet@2
74-
displayName: Install .NET 6.x runtime
77+
displayName: Use .NET 6.x runtime (for tests)
7578
inputs:
7679
packageType: runtime
7780
version: 6.x
@@ -80,29 +83,22 @@ extends:
8083
inputs:
8184
pwsh: true
8285
filePath: tools/installPSResources.ps1
83-
- task: PowerShell@2
86+
- pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration)
8487
displayName: Build and test
85-
inputs:
86-
targetType: inline
87-
pwsh: true
88-
script: Invoke-Build TestFull -Configuration $(BuildConfiguration)
8988
- task: PublishTestResults@2
9089
displayName: Publish test results
9190
inputs:
9291
testRunner: VSTest
9392
testResultsFiles: '**/*.trx'
9493
failTaskOnFailedTests: true
95-
- task: PowerShell@2
94+
- pwsh: |
95+
$assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices/bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll")
96+
if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) {
97+
Write-Host "##vso[task.LogIssue type=error;]Was not built in release configuration!"
98+
exit 1
99+
}
96100
displayName: Assert release configuration
97-
inputs:
98-
targetType: inline
99-
pwsh: true
100-
script: |
101-
$assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices/bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll")
102-
if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) {
103-
Write-Host "##vso[task.LogIssue type=error;]Was not built in release configuration!"
104-
exit 1
105-
}
101+
continueOnError: true
106102
- task: onebranch.pipeline.signing@1
107103
displayName: Sign 1st-party files
108104
inputs:
@@ -136,22 +132,10 @@ extends:
136132
dependsOn: build
137133
variables:
138134
version: $[ stageDependencies.build.main.outputs['package.version'] ]
135+
prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ]
139136
drop: $(Pipeline.Workspace)/drop_build_main
140137
jobs:
141-
- job: validation
142-
displayName: Manual validation
143-
pool:
144-
type: agentless
145-
timeoutInMinutes: 1440
146-
steps:
147-
- task: ManualValidation@0
148-
displayName: Wait 24 hours for validation
149-
inputs:
150-
notifyUsers: $(Build.RequestedForEmail)
151-
instructions: Please validate the release
152-
timeoutInMinutes: 1440
153138
- job: github
154-
dependsOn: validation
155139
displayName: Publish draft to GitHub
156140
pool:
157141
type: windows
@@ -176,7 +160,7 @@ extends:
176160
tagSource: userSpecifiedTag
177161
tag: v$(version)
178162
isDraft: true
163+
isPreRelease: $(prerelease)
179164
addChangeLog: false
180165
releaseNotesSource: inline
181-
releaseNotesInline: |
182-
# TODO: Generate release notes on GitHub!
166+
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"

tools/updateVersion.ps1

+14-12
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,32 @@ if ($LASTEXITCODE -ne 0) {
1616

1717
$v = "$($Version.Major).$($Version.Minor).$($Version.Patch)"
1818

19-
$path = "PowerShellEditorServices.Common.props"
20-
$f = Get-Content -Path $path
19+
$Path = "PowerShellEditorServices.Common.props"
20+
$f = Get-Content -Path $Path
2121
$f = $f -replace '^(?<prefix>\s+<VersionPrefix>)(.+)(?<suffix></VersionPrefix>)$', "`${prefix}${v}`${suffix}"
2222
$f = $f -replace '^(?<prefix>\s+<VersionSuffix>)(.*)(?<suffix></VersionSuffix>)$', "`${prefix}$($Version.PreReleaseLabel)`${suffix}"
23-
$f | Set-Content -Path $path
24-
git add $path
23+
$f | Set-Content -Path $Path
24+
git add $Path
2525

26-
$path = "module/PowerShellEditorServices/PowerShellEditorServices.psd1"
27-
$f = Get-Content -Path $path
26+
$Path = "module/PowerShellEditorServices/PowerShellEditorServices.psd1"
27+
$f = Get-Content -Path $Path
2828
$f = $f -replace "^(?<prefix>ModuleVersion = ')(.+)(?<suffix>')`$", "`${prefix}${v}`${suffix}"
29-
$f | Set-Content -Path $path
30-
git add $path
29+
$f | Set-Content -Path $Path
30+
git add $Path
3131

32-
$path = "CHANGELOG.md"
33-
$Changelog = Get-Content -Path $path
32+
$Path = "CHANGELOG.md"
33+
$Changelog = Get-Content -Path $Path
3434
@(
3535
$Changelog[0..1]
3636
"## v$Version"
3737
"### $([datetime]::Now.ToString('dddd, MMMM dd, yyyy'))"
3838
""
39+
"See more details at the GitHub Release for [v$Version](https://github.com/PowerShell/PowerShellEditorServices/releases/tag/v$Version)."
40+
""
3941
$Changes
4042
""
4143
$Changelog[2..$Changelog.Length]
42-
) | Set-Content -Encoding utf8NoBOM -Path $path
43-
git add $path
44+
) | Set-Content -Encoding utf8NoBOM -Path $Path
45+
git add $Path
4446

4547
git commit --edit --message "v$($Version): $Changes"

0 commit comments

Comments
 (0)