From d6de368723314326c5674e3fd089000c2e4fb24a Mon Sep 17 00:00:00 2001 From: juanonsoftware Date: Sun, 20 Jul 2025 18:01:08 +0700 Subject: [PATCH] Update script to increase version for Release --- .github/workflows/ci-master.yml | 2 +- Scripts/VersionManager.ps1 | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 2878262..5c03324 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -15,4 +15,4 @@ jobs: shell: pwsh run: | . ./Scripts/VersionManager.ps1 - New-Tag -Branch "master" \ No newline at end of file + New-Tag -Branch "master" -SourceBranch "${{ github.head_ref }}" \ No newline at end of file diff --git a/Scripts/VersionManager.ps1 b/Scripts/VersionManager.ps1 index 4f32998..cb69018 100644 --- a/Scripts/VersionManager.ps1 +++ b/Scripts/VersionManager.ps1 @@ -5,28 +5,42 @@ function New-Tag { param ( [Parameter(Mandatory=$true)] - [string]$Branch + [string]$Branch, + + [Parameter(Mandatory=$false)] + [string]$SourceBranch = "" ) $version = Get-CurrentVersion $patch = Get-NewPatch $prefix = "" + # Release branch needs to increase version and add "Beta-" prefix if ($Branch -eq "release") { $version = ([decimal]$version + 0.1).ToString() $prefix = "Beta-" } + + # Develop branch needs to increase version and add "Dev-" prefix if ($Branch -eq "develop") { $version = ([decimal]$version + 0.1).ToString() $prefix = "Dev-" } + + # Hotfix branch just needs to add "HF-" prefix if ($Branch -eq "hotfix") { $prefix = "HF-" } + # Increase version if merge from "release" branch to "master" branch + if ($Branch -eq "master" -and $SourceBranch -eq "release") + { + $version = ([decimal]$version + 0.1).ToString() + } + $tag = "v$version.$prefix$patch" Invoke-Expression "git tag $tag"