diff --git a/.github/actions/next-git-tag/next-git-tag.ps1 b/.github/actions/next-git-tag/next-git-tag.ps1 index d30f4730..b9b6f24b 100644 --- a/.github/actions/next-git-tag/next-git-tag.ps1 +++ b/.github/actions/next-git-tag/next-git-tag.ps1 @@ -9,7 +9,11 @@ Param( [Parameter(Mandatory = $true)] [ValidateSet("semver", "time")] - [string]$VersionType # Parameter to choose the versioning method: "semver" or "time" + [string]$VersionType, # Parameter to choose the versioning method: "semver" or "time" + + [Parameter(Mandatory = $false)] + [ValidateSet("incrementPatch", "incrementMinor", "incrementMajor")] + [string]$BumpType = "incrementPatch" # Parameter to choose the bump type for semver mode ) if ($VersionType -eq "semver") { @@ -36,8 +40,24 @@ if ($VersionType -eq "semver") { Write-Verbose "MINOR part: $Minor" Write-Verbose "PATCH part: $Patch" - # Hardcoded increment for patch - $Patch += 1 + switch ($BumpType) { + "incrementMajor" { + $Major += 1 + $Minor = 0 + $Patch = 0 + } + "incrementMinor" { + $Minor += 1 + $Patch = 0 + } + "incrementPatch" { + $Patch += 1 + } + default { + Write-Error "Invalid bump type specified: $BumpType" + exit 1 + } + } $NextSemverTag = "$Major.$Minor.$Patch" Write-Host "Next SemVer tag: $NextSemverTag" diff --git a/.github/workflows/build-project.yml b/.github/workflows/build-project.yml index d1cb4bed..84aa6c20 100644 --- a/.github/workflows/build-project.yml +++ b/.github/workflows/build-project.yml @@ -9,6 +9,10 @@ on: channel: type: string default: preview + incrementLevel: + description: 'Version level to increment' + type: string + default: incrementPatch outputs: version: description: 'next Git tag in semver format' @@ -32,7 +36,7 @@ jobs: id: vsix_version run: | if ("${{ inputs.channel}}" -eq "stable") { - & ".\.github\actions\next-git-tag\next-git-tag.ps1" semver + & ".\.github\actions\next-git-tag\next-git-tag.ps1" semver "${{ inputs.incrementLevel }}" } elseif ("${{ inputs.channel }}" -eq "preview") { & ".\.github\actions\next-git-tag\next-git-tag.ps1" time diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml index 60458792..aaa300fb 100644 --- a/.github/workflows/release-preview.yml +++ b/.github/workflows/release-preview.yml @@ -15,6 +15,7 @@ jobs: with: solution-file-path: . channel: preview + incrementLevel: incrementPatch secrets: inherit run-integration-tests: needs: build-project diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69b6862e..f2bdcb0d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,16 @@ name: Release Extension on: workflow_dispatch: - + inputs: + incrementLevel: + description: 'Version level to increment' + required: true + type: choice + options: + - incrementPatch + - incrementMinor + - incrementMajor + default: incrementPatch env: SOLUTION_FILE_PATH: . DEFAULT_BRANCH: main @@ -13,6 +22,7 @@ jobs: with: solution-file-path: . channel: stable + incrementLevel: ${{ inputs.incrementLevel }} secrets: inherit run-integration-tests: needs: build-project diff --git a/Snyk.VisualStudio.Extension.2022/Download/SnykCliDownloader.cs b/Snyk.VisualStudio.Extension.2022/Download/SnykCliDownloader.cs index d3aa869c..5a812a6a 100644 --- a/Snyk.VisualStudio.Extension.2022/Download/SnykCliDownloader.cs +++ b/Snyk.VisualStudio.Extension.2022/Download/SnykCliDownloader.cs @@ -18,7 +18,7 @@ namespace Snyk.VisualStudio.Extension.Download public class SnykCliDownloader { public const string DefaultBaseDownloadUrl = "https://downloads.snyk.io"; - public const string DefaultReleaseChannel = "preview"; + public const string DefaultReleaseChannel = "stable"; private const string LatestReleaseVersionUrlScheme = "{0}/cli/{1}/ls-protocol-version-" + LsConstants.ProtocolVersion; private const string LatestReleaseDownloadUrlScheme = "{0}/cli/{1}/" + SnykCli.CliFileName;