Skip to content

Commit fba1aac

Browse files
committed
Update version tools and docs for new version scheme
1 parent 4f47aa4 commit fba1aac

File tree

3 files changed

+52
-42
lines changed

3 files changed

+52
-42
lines changed

docs/development.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ New-ReleaseBundle -PsesVersion <version> -VsceVersion <version>
7474
# Permit vscode-extension pipeline to publish to marketplace
7575
```
7676

77-
If rolling from pre-release to stable, use:
77+
If rolling from pre-release to release, use:
7878

7979
```powershell
8080
New-Release -RepositoryName vscode-powershell -Version <version>
8181
```
8282

8383
This is because we do not change the version of PowerShell Editor Services between a
84-
pre-release and the subsequent stable release, so we only need to release the extension.
84+
pre-release and the subsequent release, so we only need to release the extension.
8585

8686
### Versioning
8787

@@ -97,48 +97,54 @@ For PowerShellEditor Services, we simply follow semantic versioning, e.g.
9797
generally used directly: it's a library consumed by other projects which
9898
themselves use pre-releases for beta testing.
9999

100-
For the VS Code PowerShell Extension, our version follows `vYYYY.M.X`, that is:
101-
current year, current month, and patch version (not day). This is not semantic
102-
versioning because of issues with how the VS Code marketplace and extension
103-
hosting API itself uses our version number. This scheme _does not_ mean we
104-
release on a chronological schedule: we release based on completed work. If the
105-
month has changed over since the last release, the patch version resets to 0.
106-
Each subsequent release that month increments the patch version.
107-
108-
Before releasing a stable version we should almost always first release a preview of the
109-
same code, which is a _pre-release_. The exception to this is hotfix releases where we
110-
need to push _only_ bug fixes out as soon as possible, and these should be built off the
111-
last release's codebase (found from the Git tag). The pre-release is uploaded to the
112-
marketplace using the `--pre-release` flag given to `vsce` (the CLI tool used to do so).
113-
The previous separate "PowerShell Preview" extension has been deprecated in favor of using
114-
the marketplace's support for [pre-releases][] on the stable and now one-and-only
100+
For the VS Code PowerShell Extension, our version follows `vYYYY.X.Z`, that is: current
101+
year, minor version, and patch version. This is not semantic versioning because of issues
102+
with how the VS Code marketplace and extension hosting API itself uses our version number.
103+
We do not release on a chronological schedule: we release based on completed work. For
104+
historical reasons we are stuck with the major version being year.
105+
106+
Before releasing a stable version (a _release_) we should almost always first release a
107+
preview of the same code, which is a _pre-release_. The exception to this is hotfix
108+
releases where we need to push _only_ bug fixes out as soon as possible, and these should
109+
be built off the last release's codebase (found from the Git tag). The pre-release is
110+
uploaded to the marketplace using the `--pre-release` flag given to `vsce` (the CLI tool
111+
used to do so). The previous separate "PowerShell Preview" extension has been deprecated
112+
in favor of using the marketplace's support for [pre-releases][] on the one-and-only
115113
extension.
116114

117115
Because the marketplace does not actually understand Semantic Versioning pre-release tags
118116
(the `-preview` suffix), the patch numbers need to increment continuously, but we append
119117
`-preview` to _our_ version in the changelog and Git tags. When multiple pre-releases are
120118
needed, the patch version is incremented (again because the marketplace ignores the
121-
pre-release tag, we can't do `-alpha`, `-beta` etc.). Since migrating to a single
122-
extension, the stable release has to increment one more after the last pre-release. So the
123-
stable version may jump a few patch versions in between releases. Furthermore, the
124-
`preview` field in the extension's manifest (the `package.json` file) is _always_ `false`,
125-
even for pre-releases, because the marketplace takes the information from the latest
126-
release inclusive of pre-releases, hence it was causing the one-and-only extension to look
127-
like it was in preview. This is also why the icon no longer changes to the PowerShell
128-
Preview icon for pre-releases. When they support pre-releases better (ideally that means
129-
supporting the pre-release tags in full) we can revisit this.
119+
pre-release tag, we can't do `-alpha`, `-beta` etc.). The `preview` field in
120+
the extension's manifest (the `package.json` file) is _always_ `false`, even for
121+
pre-releases, because the marketplace takes the information from the latest release
122+
inclusive of pre-releases, hence it was causing the one-and-only extension to look like it
123+
was in preview. This is also why the icon no longer changes to the PowerShell Preview icon
124+
for pre-releases. When they support pre-releases better (ideally that means supporting the
125+
pre-release tags in full) we can revisit this.
126+
127+
Furthermore, for releases, the minor version must be _even_ (like 0, 2, etc.) and for
128+
pre-releases it must be _odd_ (like 1, 3, etc.), and an upcoming release's version must be
129+
`n-1` of the pre-release which previews it. That is, release `v2024.0.0` is previewed in
130+
the pre-release `v2024.1.0`. This scheme is designed such that the "newest" (by version)
131+
release is always a pre-release, so that the VS Code marketplace _always_ shows a
132+
pre-release option. When we previously did this the other way around (incrementing the
133+
release as `n+1` to the pre-release), every time we released, the pre-release option
134+
(dropdown) in the marketplace would unfortunately disappear.
130135

131136
[pre-releases]: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions
132137

133-
For example, the date is May 7, 2022. The last release was in April, and its version was
134-
`v2022.4.3`. Some significant work has been completed and we want to release the
135-
extension. First we create a pre-release with version `v2022.5.0-preview` (the patch reset
136-
to 0 because the month changed, and `-preview` was appended). After publishing, some
137-
issues were identified and we decided we needed a second pre-release. Its version is
138-
`v2022.5.1-preview`. User feedback indicates that pre-release is working well, so to
139-
create a stable release we use the same code (but with an updated changelog etc.) and use
140-
version `v2022.5.2`, the _first_ stable release for May (as `v2022.5.0` was skipped due to
141-
those identified issues in the pre-release). All of these releases may consume the same or
142-
different version of PowerShell Editor Services, say `v3.2.4`. It may update between
143-
pre-release versions or stable versions, but must not change between a pre-release and the
144-
subsequent stable release, as they should use the same code which includes dependencies.
138+
For example, the date is August 23, 2023. The last release was in June, and its version
139+
was `v2023.6.0`. Some significant work has been completed and we want to release the
140+
extension, so the next release will be `v2023.8.0` (the minor version is `n+2` because it
141+
must remain even, it only coincidentally matches the month). That means first we create a
142+
pre-release with version `v2023.9.0-preview` (the minor version is `n+1` of the upcoming
143+
release, and `-preview` was appended). After publishing, some issues were identified and
144+
we decided we needed a second pre-release. Its version is `v2023.9.1-preview`. User
145+
feedback hopefully indicates that the pre-release is working well, so to create a release
146+
we will use the same code (but with an updated changelog etc.) and use version
147+
`v2023.8.0`, the _next_ release since `v2023.6.0`. The version of PowerShell Editor
148+
Services may update between pre-releases or releases, but must not change between a
149+
pre-release and its subsequent release, as they should use the same code (which includes
150+
dependencies).

tools/ReleaseTools.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Get-Bullets {
4444
)
4545
begin {
4646
$SkipThanks = @(
47-
'andschwa'
47+
'andyleejordan'
4848
'daxian-dbw'
4949
'PaulHigin'
5050
'SeeminglyScience'

tools/VersionTools.psm1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,17 @@ function Test-VersionIsValid {
125125
if ($SemanticVersion.Major -ne $Date.Year) {
126126
throw "Major version should be the current year!"
127127
}
128-
if ($SemanticVersion.Minor -ne $Date.Month) {
129-
throw "Minor version should be the current month!"
130-
}
131128
if ($SemanticVersion.PreReleaseLabel) {
132129
if ($SemanticVersion.PreReleaseLabel -ne "preview") {
133130
throw "Suffix should only be 'preview'!"
134131
}
132+
if ($SemanticVersion.Minor % 2 -eq 0) {
133+
throw "Minor version must be odd for pre-release!"
134+
}
135+
} else {
136+
if ($SemanticVersion.Minor % 2 -ne 0) {
137+
throw "Minor version must be even for pre-release!"
138+
}
135139
}
136140
}
137141
"PowerShellEditorServices" {

0 commit comments

Comments
 (0)