File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,21 @@ function Get-FirstChangelog {
134
134
)
135
135
}
136
136
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
+
137
152
<#
138
153
. SYNOPSIS
139
154
Gets current version from changelog as [semver].
@@ -221,10 +236,7 @@ function Update-Changelog {
221
236
) | Set-Content - Encoding utf8NoBOM - Path $ChangelogFile
222
237
223
238
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
228
240
git add $ChangelogFile
229
241
git commit - m " Update CHANGELOG for $Version "
230
242
}
@@ -311,6 +323,7 @@ function Update-Version {
311
323
}
312
324
313
325
if ($PSCmdlet.ShouldProcess (" $RepositoryName /v$Version " , " git commit" )) {
326
+ Update-Branch - Version $Version
314
327
git commit - m " Bump version to v$Version "
315
328
}
316
329
You can’t perform that action at this time.
0 commit comments