Skip to content

Commit b88df7a

Browse files
committed
Support 'preview' in version
1 parent db3d833 commit b88df7a

File tree

2 files changed

+30
-32
lines changed

2 files changed

+30
-32
lines changed

.pipelines/PowerShellEditorServices-Official.yml

+16-20
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,21 @@ 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-
}
106101
- task: onebranch.pipeline.signing@1
107102
displayName: Sign 1st-party files
108103
inputs:
@@ -136,6 +131,7 @@ extends:
136131
dependsOn: build
137132
variables:
138133
version: $[ stageDependencies.build.main.outputs['package.version'] ]
134+
prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ]
139135
drop: $(Pipeline.Workspace)/drop_build_main
140136
jobs:
141137
- job: validation
@@ -176,7 +172,7 @@ extends:
176172
tagSource: userSpecifiedTag
177173
tag: v$(version)
178174
isDraft: true
175+
isPreRelease: $(prerelease)
179176
addChangeLog: false
180177
releaseNotesSource: inline
181-
releaseNotesInline: |
182-
# TODO: Generate release notes on GitHub!
178+
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)