Skip to content

Commit 3a304bb

Browse files
authored
chore: support minor major semver bumps (#339)
* feat: support major and minor semver bumps * chore: set default CLI release channel to stable * chore: test new wf * chore: revert back test wf * fix: use gh input options
1 parent 6794ceb commit 3a304bb

File tree

5 files changed

+41
-6
lines changed

5 files changed

+41
-6
lines changed

.github/actions/next-git-tag/next-git-tag.ps1

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
Param(
1010
[Parameter(Mandatory = $true)]
1111
[ValidateSet("semver", "time")]
12-
[string]$VersionType # Parameter to choose the versioning method: "semver" or "time"
12+
[string]$VersionType, # Parameter to choose the versioning method: "semver" or "time"
13+
14+
[Parameter(Mandatory = $false)]
15+
[ValidateSet("incrementPatch", "incrementMinor", "incrementMajor")]
16+
[string]$BumpType = "incrementPatch" # Parameter to choose the bump type for semver mode
1317
)
1418

1519
if ($VersionType -eq "semver") {
@@ -36,8 +40,24 @@ if ($VersionType -eq "semver") {
3640
Write-Verbose "MINOR part: $Minor"
3741
Write-Verbose "PATCH part: $Patch"
3842

39-
# Hardcoded increment for patch
40-
$Patch += 1
43+
switch ($BumpType) {
44+
"incrementMajor" {
45+
$Major += 1
46+
$Minor = 0
47+
$Patch = 0
48+
}
49+
"incrementMinor" {
50+
$Minor += 1
51+
$Patch = 0
52+
}
53+
"incrementPatch" {
54+
$Patch += 1
55+
}
56+
default {
57+
Write-Error "Invalid bump type specified: $BumpType"
58+
exit 1
59+
}
60+
}
4161

4262
$NextSemverTag = "$Major.$Minor.$Patch"
4363
Write-Host "Next SemVer tag: $NextSemverTag"

.github/workflows/build-project.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
channel:
1010
type: string
1111
default: preview
12+
incrementLevel:
13+
description: 'Version level to increment'
14+
type: string
15+
default: incrementPatch
1216
outputs:
1317
version:
1418
description: 'next Git tag in semver format'
@@ -32,7 +36,7 @@ jobs:
3236
id: vsix_version
3337
run: |
3438
if ("${{ inputs.channel}}" -eq "stable") {
35-
& ".\.github\actions\next-git-tag\next-git-tag.ps1" semver
39+
& ".\.github\actions\next-git-tag\next-git-tag.ps1" semver "${{ inputs.incrementLevel }}"
3640
}
3741
elseif ("${{ inputs.channel }}" -eq "preview") {
3842
& ".\.github\actions\next-git-tag\next-git-tag.ps1" time

.github/workflows/release-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with:
1616
solution-file-path: .
1717
channel: preview
18+
incrementLevel: incrementPatch
1819
secrets: inherit
1920
run-integration-tests:
2021
needs: build-project

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ name: Release Extension
22

33
on:
44
workflow_dispatch:
5-
5+
inputs:
6+
incrementLevel:
7+
description: 'Version level to increment'
8+
required: true
9+
type: choice
10+
options:
11+
- incrementPatch
12+
- incrementMinor
13+
- incrementMajor
14+
default: incrementPatch
615
env:
716
SOLUTION_FILE_PATH: .
817
DEFAULT_BRANCH: main
@@ -13,6 +22,7 @@ jobs:
1322
with:
1423
solution-file-path: .
1524
channel: stable
25+
incrementLevel: ${{ inputs.incrementLevel }}
1626
secrets: inherit
1727
run-integration-tests:
1828
needs: build-project

Snyk.VisualStudio.Extension.2022/Download/SnykCliDownloader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Snyk.VisualStudio.Extension.Download
1818
public class SnykCliDownloader
1919
{
2020
public const string DefaultBaseDownloadUrl = "https://downloads.snyk.io";
21-
public const string DefaultReleaseChannel = "preview";
21+
public const string DefaultReleaseChannel = "stable";
2222

2323
private const string LatestReleaseVersionUrlScheme = "{0}/cli/{1}/ls-protocol-version-" + LsConstants.ProtocolVersion;
2424
private const string LatestReleaseDownloadUrlScheme = "{0}/cli/{1}/" + SnykCli.CliFileName;

0 commit comments

Comments
 (0)