Skip to content

Commit 5e00f8e

Browse files
Merge pull request #3431 from PowerShell/andschwa/release-refinements
Release refinements
2 parents b23beda + f45823b commit 5e00f8e

File tree

3 files changed

+80
-25
lines changed

3 files changed

+80
-25
lines changed

.vsts-ci/templates/release-general.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ steps:
3333

3434
- template: EsrpSign.yml@ComplianceRepo
3535
parameters:
36-
# TODO: $[in(variables['Build.Reason'], 'Manual', 'ResourceTrigger')]
37-
shouldSign: true
3836
buildOutputPath: '$(Build.ArtifactStagingDirectory)/vscode-powershell'
3937
signOutputPath: '$(Build.ArtifactStagingDirectory)/Signed'
4038
alwaysCopy: true # So publishing works
4139
certificateId: 'CP-230012' # Authenticode certificate
4240
useMinimatch: true # This enables the use of globbing
41+
shouldSign: true # We always want to sign
4342
# NOTE: Code AKA *.vsix files are not signed
4443
pattern: |
4544
Install-VSCode.ps1
45+
InvokePesterStub.ps1
4646
4747
- template: EsrpScan.yml@ComplianceRepo
4848
parameters:

docs/development.md

+49-1
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,65 @@ New-DraftRelease -RepositoryName vscode-powershell
8080
# Upload PowerShellEditorServices.zip (for other extensions)
8181
# Upload VSIX and Install-VSCode.ps1
8282
# Publish draft releases and merge (don't squash!) branches
83+
# Check telemetry for stability before releasing
8384
vsce publish --packagePath ./PowerShell-<version>.vsix
8485
# Update Install-VSCode.ps1 on gallery
8586
Publish-Script -Path ./Install-VSCode.ps1 -NuGetApiKey (Get-Secret "PowerShell Gallery API Key" -AsPlainText)
8687
```
8788

89+
### Versioning
90+
91+
For both our repositories we use Git tags in the form `vX.Y.Z` to mark the
92+
releases in the codebase. We use the GitHub Release feature to create these
93+
tags. Branches are used in the process of creating a release, e.g.
94+
`release/vX.Y.Z`, but are deleted after the release is completed (and merged
95+
into `master`).
96+
97+
For PowerShellEditor Services, we simply follow semantic versioning, e.g.
98+
`vX.Y.Z`. We do not release previews frequently because this dependency is not
99+
generally used directly: it's a library consumed by other projects which
100+
themselves use preview releases for beta testing.
101+
102+
For the VS Code PowerShell Extension, our version follows `vYYYY.MM.X`, that is:
103+
current year, current month, and patch version (not day). This is not semantic
104+
versioning because of issues with how the VS Code marketplace and extension
105+
hosting API itself uses our version number. This scheme _does not_ mean we
106+
release on a chronological schedule: we release based on completed work. If the
107+
month has changed over since the last release, the patch version resets to 0.
108+
Each subsequent release that month increments the patch version.
109+
110+
Before releasing a "stable" release we should almost always first release a
111+
"preview" of the same code. The exception to this is "hotfix" releases where we
112+
need to push _only_ bug fixes out as soon as possible, and these should be built
113+
off the last release's codebase (found from the Git tag). The preview release is
114+
uploaded separately to the marketplace as the "PowerShell Preview" extension. It
115+
should not significantly diverge from the stable release ("PowerShell"
116+
extension), but is used for public beta testing. The preview version should
117+
match the upcoming stable version, but with `-preview` appended. When multiple
118+
previews are needed, the patch version is incremented, and the last preview's
119+
version is used for the stable release. (So the stable version may jump a few
120+
patch versions in between releases.)
121+
122+
For example, the date is May 7, 2022. The last release was in April, and its
123+
version was `v2022.4.3`. Some significant work has been completed and we want to
124+
release the extension. First we create a preview release with version
125+
`v2022.5.0-preview` (the patch reset to 0 because the month changed, and
126+
`-preview` was appended). After publishing, some issues were identified and we
127+
decided we needed a second preview release. Its version is `v2022.5.1-preview`.
128+
User feedback indicates that preview is working well, so to create a stable
129+
release we use the same code (but with an updated changelog etc.) and use
130+
version `v2022.5.1`, the _first_ stable release for May (as `v2022.5.0` was
131+
skipped due to those identified issues in the preview). All of these releases
132+
may consume the same or different version of PowerShell Editor Services, say
133+
`v3.2.4`. It may update between preview versions or stable versions (but should
134+
not change between a preview and its associated stable release, as they should
135+
use the same code which includes dependencies).
136+
88137
### Pending Improvements
89138

90139
* `Update-Changelog` should verify the version is in the correct format
91140
* `Update-Changelog` could be faster by not downloading _every_ PR
92141
* `Update-Changelog` should use exactly two emoji and in the right order
93142
* `Update-Version` could be run by `Update-Changelog`
94-
* `New-DraftRelease` could automatically set the tag pointers and upload the binaries
95143
* The build should emit an appropriately named VSIX instead of us manually renaming it
96144
* A `Publish-Binaries` function could be written to push the binaries out

tools/ReleaseTools.psm1

+29-22
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ function Get-FirstChangelog {
134134
)
135135
}
136136

137+
<#
138+
.SYNOPSIS
139+
Creates and checks out `release/v<version>` if not already on it.
140+
#>
141+
function Update-Branch {
142+
param(
143+
[Parameter(Mandatory)]
144+
[string]$Version
145+
)
146+
$branch = git branch --show-current
147+
if ($branch -ne "release/v$Version") {
148+
git checkout -b "release/v$Version"
149+
}
150+
}
151+
137152
<#
138153
.SYNOPSIS
139154
Gets current version from changelog as [semver].
@@ -221,12 +236,9 @@ function Update-Changelog {
221236
) | Set-Content -Encoding utf8NoBOM -Path $ChangelogFile
222237

223238
if ($PSCmdlet.ShouldProcess("$RepositoryName/$ChangelogFile", "git")) {
224-
$branch = git branch --show-current
225-
if ($branch -ne "release/$Version") {
226-
git checkout -b "release/$Version"
227-
}
239+
Update-Branch -Version $Version
228240
git add $ChangelogFile
229-
git commit -m "Update CHANGELOG for $Version"
241+
git commit -m "Update CHANGELOG for ``v$Version``"
230242
}
231243

232244
Pop-Location
@@ -311,7 +323,8 @@ function Update-Version {
311323
}
312324

313325
if ($PSCmdlet.ShouldProcess("$RepositoryName/v$Version", "git commit")) {
314-
git commit -m "Bump version to v$Version"
326+
Update-Branch -Version $Version
327+
git commit -m "Bump version to ``v$Version``"
315328
}
316329

317330
Pop-Location
@@ -326,34 +339,28 @@ function Update-Version {
326339
are prefixed with a `v`. Creates a Git tag if it does not already exist.
327340
#>
328341
function New-DraftRelease {
329-
[CmdletBinding(SupportsShouldProcess)]
330342
param(
331343
[Parameter(Mandatory)]
332344
[ValidateSet([RepoNames])]
333-
[string]$RepositoryName
345+
[string]$RepositoryName,
346+
347+
[Parameter(ValueFromPipeline)]
348+
[string[]]$Assets
334349
)
335350
$Version = Get-Version -RepositoryName $RepositoryName
336351
$Changelog = (Get-FirstChangelog -RepositoryName $RepositoryName) -join "`n"
337352
$ReleaseParams = @{
338353
Draft = $true
354+
# NOTE: We rely on GitHub to create the tag at that branch.
339355
Tag = "v$Version"
356+
Committish = "release/v$Version"
340357
Name = "v$Version"
341358
Body = $ChangeLog
342359
PreRelease = [bool]$Version.PreReleaseLabel
343-
# TODO: Pass -WhatIf and -Confirm parameters correctly.
344-
}
345-
346-
if ($PSCmdlet.ShouldProcess("$RepositoryName/v$Version", "git tag")) {
347-
# NOTE: This a side effect neccesary for Git operations to work.
348-
Push-Location -Path "$PSScriptRoot/../../$RepositoryName"
349-
if (-not (git show-ref --tags "v$Version")) {
350-
git tag "v$Version"
351-
} else {
352-
Write-Warning "git tag $RepositoryName/v$Version already exists!"
353-
}
354-
Pop-Location
360+
OwnerName = "PowerShell"
361+
RepositoryName = $RepositoryName
355362
}
356363

357-
Get-GitHubRepository -OwnerName PowerShell -RepositoryName $RepositoryName |
358-
New-GitHubRelease @ReleaseParams
364+
$Release = New-GitHubRelease @ReleaseParams
365+
$Assets | New-GitHubReleaseAsset -Release $Release.Id
359366
}

0 commit comments

Comments
 (0)