From d6156f0f1e617ef1757629aa3f2e1b0669b87d83 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 27 Jan 2026 12:14:03 +0000 Subject: [PATCH] release branch builds increment patch versions and master builds increment minor versions --- build/Program.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build/Program.cs b/build/Program.cs index 47a86745..e14e1304 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -240,8 +240,22 @@ static async Task<(string version, bool isPrerelease)> GetVersion() var lastTag = allTags.OrderBy(tag => Version.Parse(tag)).LastOrDefault() ?? "0.0.0"; var lastVersion = Version.Parse(lastTag); - // Increment minor version for next release - var nextVersion = new Version(lastVersion.Major, lastVersion.Minor + 1, 0); + // Determine version increment based on branch + var currentBranch = await GetCurrentBranch(); + Version nextVersion; + + if (currentBranch == "release") + { + // Release branch: increment patch version + nextVersion = new Version(lastVersion.Major, lastVersion.Minor, lastVersion.Build + 1); + Console.WriteLine($"Building prerelease for release branch (patch increment)"); + } + else + { + // Master or other branches: increment minor version + nextVersion = new Version(lastVersion.Major, lastVersion.Minor + 1, 0); + Console.WriteLine($"Building prerelease for {currentBranch} branch (minor increment)"); + } // Use commit count since the last version tag if available; otherwise, fall back to total count var revListArgs = allTags.Any() ? $"--count {lastTag}..HEAD" : "--count HEAD";