From 467dc47afce015cd7ee59b2744077a51808c1ca6 Mon Sep 17 00:00:00 2001 From: Jean-Marc Couffin Date: Sun, 15 Nov 2026 21:18:22 +0100 Subject: [PATCH] fix(build): title GitHub releases with the semantic version only The release title used InstallVersion (7.0.1.26312); it now uses the new VersionInfo.SemanticVersion (7.1.0). Tags, asset names and installer versions keep the full build version. Co-Authored-By: Claude Opus 5.5 --- build/Helpers/VersionHelper.cs | 7 ++++++- build/Models/VersionInfo.cs | 11 ++++++++++- build/Modules/PublishGithubReleaseModule.cs | 2 +- build/tests/VersionHelperTests.cs | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/build/Helpers/VersionHelper.cs b/build/Helpers/VersionHelper.cs index 5a675cc19d..ea957ec8d1 100644 --- a/build/Helpers/VersionHelper.cs +++ b/build/Helpers/VersionHelper.cs @@ -43,11 +43,16 @@ public static string ReadVersionFromFile(string path, bool urlSafe = false) public static VersionInfo CreateVersionInfo(string buildVersion) { var installVersion = buildVersion.Split('+')[0]; + var versionParts = VersionPartFinder().Match(buildVersion); + var semanticVersion = versionParts.Success + ? $"{versionParts.Groups[1].Value}.{versionParts.Groups[2].Value}.{versionParts.Groups[3].Value}" + : installVersion; return new VersionInfo( buildVersion, installVersion, buildVersion.Replace("+", "%2B", StringComparison.Ordinal), - buildVersion.Contains(PyRevitPaths.WipVersionExtension, StringComparison.Ordinal)); + buildVersion.Contains(PyRevitPaths.WipVersionExtension, StringComparison.Ordinal), + semanticVersion); } public static string UpdateBuildNumber(string version) diff --git a/build/Models/VersionInfo.cs b/build/Models/VersionInfo.cs index cf1284871d..480c64aec7 100644 --- a/build/Models/VersionInfo.cs +++ b/build/Models/VersionInfo.cs @@ -1,7 +1,16 @@ namespace Build.Models; +/// +/// Version strings for one build, all derived from the stamped build version. +/// +/// Full version with build metadata, such as 7.1.0.26319+1907; used for tags. +/// Version without the +HHmm metadata, such as 7.1.0.26319; used for installer names. +/// with + encoded for URLs. +/// True for WIP channel builds. +/// major.minor.patch only, such as 7.1.0; the public release title uses it. public sealed record VersionInfo( string BuildVersion, string InstallVersion, string BuildVersionUrlSafe, - bool IsWip); + bool IsWip, + string SemanticVersion); diff --git a/build/Modules/PublishGithubReleaseModule.cs b/build/Modules/PublishGithubReleaseModule.cs index 44398410e3..5d6c0a88c7 100644 --- a/build/Modules/PublishGithubReleaseModule.cs +++ b/build/Modules/PublishGithubReleaseModule.cs @@ -27,7 +27,7 @@ public sealed class PublishGithubReleaseModule(IOptions publishO var repositoryInfo = context.GitHub().RepositoryInfo; var newRelease = new NewRelease("v" + versionInfo.BuildVersion) { - Name = "pyRevit v" + versionInfo.InstallVersion, + Name = "pyRevit v" + versionInfo.SemanticVersion, Body = releaseNotes, Draft = publishOptions.Value.DraftRelease, Prerelease = versionInfo.IsWip, diff --git a/build/tests/VersionHelperTests.cs b/build/tests/VersionHelperTests.cs index 7ff3855c06..f9b3e728fd 100644 --- a/build/tests/VersionHelperTests.cs +++ b/build/tests/VersionHelperTests.cs @@ -115,4 +115,23 @@ public void GetCloneBinAssetName_includesVersionTag() { Assert.AreEqual("bin-v6.5.3.26176+2017.zip", VersionHelper.GetCloneBinAssetName("6.5.3.26176+2017")); } + + [TestMethod] + public void CreateVersionInfo_semanticVersionDropsBuildNumberAndMetadata() + { + var info = VersionHelper.CreateVersionInfo("7.1.0.26319+1907"); + + Assert.AreEqual("7.1.0", info.SemanticVersion); + Assert.AreEqual("7.1.0.26319", info.InstallVersion); + Assert.AreEqual("7.1.0.26319+1907", info.BuildVersion); + } + + [TestMethod] + public void CreateVersionInfo_semanticVersionDropsWipSuffix() + { + var info = VersionHelper.CreateVersionInfo("7.2.0.26330+1015-wip"); + + Assert.AreEqual("7.2.0", info.SemanticVersion); + Assert.IsTrue(info.IsWip); + } }