Skip to content

Commit d54ffc7

Browse files
committed
Setup to use release branches for ADO
This will let us use the pipeline trigger because we can set the default branch for manual/scheduled/pipeline-triggered builds to `release` (but cannot set it to a variable branch, like `release/vX.Y.Z`).
1 parent 5253650 commit d54ffc7

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

.vsts-ci/azure-pipelines-release.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ variables:
66
- name: DOTNET_CLI_TELEMETRY_OPTOUT
77
value: 'true'
88

9-
trigger:
10-
branches:
11-
include:
12-
- release/*
9+
trigger: none
1310

1411
resources:
1512
repositories:
@@ -20,12 +17,8 @@ resources:
2017
pipelines:
2118
- pipeline: PowerShellEditorServices
2219
source: PowerShellEditorServices
23-
trigger:
24-
branches:
25-
include:
26-
- release/*
27-
tags:
28-
- v*
20+
trigger: true
21+
2922

3023
jobs:
3124
- job: 'ReleaseBuild'

docs/development.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,23 @@ Microsoft. The comments are manual steps.
6767
Import-Module ./tools/ReleaseTools.psm1
6868
Update-Changelog -RepositoryName PowerShellEditorServices -Version <version>
6969
Update-Changelog -RepositoryName vscode-powershell -Version <version>
70-
# Amend changelog as necessary
71-
# Download and test assets (assert correct PSES is included)
72-
New-DraftRelease -RepositoryName PowerShellEditorServices -Assets "PowerShellEditorServices.zip"
73-
New-DraftRelease -RepositoryName vscode-powershell -Assets "powershell-YYYY.M.X.vsix", "Install-VSCode.ps1"
70+
# Amend changelog as necessary, open PR
71+
# Push release branches to ADO
72+
# Permit both pipelines to draft GitHub releases
73+
# Download and test assets
7474
# Check telemetry for stability before releasing
7575
# Publish draft releases and merge (don't squash!) branches
76-
vsce publish --packagePath ./PowerShell-<version>.vsix
77-
# Update Install-VSCode.ps1 on gallery
78-
Publish-Script -Path ./Install-VSCode.ps1 -NuGetApiKey (Get-Secret "PowerShell Gallery API Key" -AsPlainText)
76+
# Permit vscode-extension pipeline to publish to marketplace
7977
```
8078

8179
### Versioning
8280

83-
For both our repositories we use Git tags in the form `vX.Y.Z` to mark the
84-
releases in the codebase. We use the GitHub Release feature to create these
85-
tags. Branches are used in the process of creating a release, e.g.
86-
`release/vX.Y.Z`, but are deleted after the release is completed (and merged
87-
into `master`).
81+
For both our repositories we use Git tags in the form `vX.Y.Z` to mark the releases in the
82+
codebase. We use the GitHub Release feature to create these tags. The ephemeral branch
83+
`release` is used in the process of creating a release for each repository, primarily for
84+
the Pull Requests and for Azure DevOps triggers. Once the release PRs are merged, the
85+
branch is deleted until used again to prepare the next release. This branch _does not_
86+
mark any specific release, that is the point of the tags.
8887

8988
For PowerShellEditor Services, we simply follow semantic versioning, e.g.
9089
`vX.Y.Z`. We do not release previews frequently because this dependency is not
@@ -130,4 +129,3 @@ use the same code which includes dependencies).
130129

131130
* `Update-Changelog` should verify the version is in the correct format
132131
* `Update-Changelog` could be faster by not downloading _every_ PR
133-
* A `Publish-Binaries` function could be written to push the binaries out

tools/ReleaseTools.psm1

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,21 @@ function Get-FirstChangelog {
136136

137137
<#
138138
.SYNOPSIS
139-
Creates and checks out `release/v<version>` if not already on it.
139+
Creates and checks out `release` if not already on it.
140140
#>
141141
function Update-Branch {
142142
[CmdletBinding(SupportsShouldProcess)]
143-
param(
144-
[Parameter(Mandatory)]
145-
[string]$Version
146-
)
147143
$Branch = git branch --show-current
148-
$NewBranch = "release/v$Version"
149-
if ($Branch -ne $NewBranch) {
150-
if ($PSCmdlet.ShouldProcess($NewBranch, "git checkout -b")) {
151-
git checkout -b $NewBranch
144+
if ($Branch -ne "release") {
145+
if ($PSCmdlet.ShouldProcess("release", "git checkout -b")) {
146+
git checkout -b "release"
152147
}
153148
}
154149
}
155150

156151
<#
157152
.SYNOPSIS
158-
Gets current version from changelog as [semver].
153+
Gets current version from changelog as `[semver]`.
159154
#>
160155
function Get-Version {
161156
param(
@@ -176,10 +171,9 @@ function Get-Version {
176171
.SYNOPSIS
177172
Updates the CHANGELOG file with PRs merged since the last release.
178173
.DESCRIPTION
179-
Uses the local Git repositories but does not pull, so ensure HEAD is where
180-
you want it. Creates a new branch at 'release/$Version' if not already
181-
checked out. Handles any merge option for PRs, but is a little slow as it
182-
queries all PRs.
174+
Uses the local Git repositories but does not pull, so ensure HEAD is where you
175+
want it. Creates the branch `release` if not already checked out. Handles any
176+
merge option for PRs, but is a little slow as it queries all PRs.
183177
#>
184178
function Update-Changelog {
185179
[CmdletBinding(SupportsShouldProcess)]
@@ -238,7 +232,7 @@ function Update-Changelog {
238232
$CurrentChangelog[2..$CurrentChangelog.Length]
239233
) | Set-Content -Encoding utf8NoBOM -Path $ChangelogFile
240234

241-
Update-Branch -Version $Version.Substring(1) # Has "v" prefix
235+
Update-Branch
242236

243237
if ($PSCmdlet.ShouldProcess("$RepositoryName/$ChangelogFile", "git commit")) {
244238
git add $ChangelogFile
@@ -328,7 +322,7 @@ function Update-Version {
328322
}
329323
}
330324

331-
Update-Branch -Version $Version
325+
Update-Branch
332326

333327
if ($PSCmdlet.ShouldProcess("$RepositoryName/v$Version", "git commit")) {
334328
git commit -m "Bump version to ``v$Version``"
@@ -409,7 +403,7 @@ function New-DraftRelease {
409403
$ReleaseParams = @{
410404
# NOTE: We rely on GitHub to create the tag at that branch.
411405
Tag = "v$Version"
412-
Committish = "release/v$Version"
406+
Committish = "release"
413407
Name = "v$Version"
414408
Body = $ChangeLog
415409
Draft = $true

0 commit comments

Comments
 (0)