Skip to content

Commit 32e6025

Browse files
authored
Preserve alpha release tags in GitVersion
Configure GitVersion and CI guardrails so alpha tags resolve to their exact SemVer.
1 parent 97fb8df commit 32e6025

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ jobs:
106106
id: gitversion
107107
uses: gittools/actions/gitversion/execute@v4
108108

109+
- name: Verify tag version output
110+
if: startsWith(github.ref, 'refs/tags/v')
111+
shell: pwsh
112+
run: |
113+
$expected = "${{ github.ref_name }}" -replace '^v', ''
114+
$actual = "${{ steps.gitversion.outputs.semVer }}"
115+
if ($actual -ne $expected) {
116+
throw "GitVersion SemVer '$actual' did not match tag '$expected'."
117+
}
118+
109119
- name: Restore dependencies
110120
run: dotnet restore
111121

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ assembly-versioning-scheme: MajorMinorPatch
55
branches:
66
main:
77
regex: ^(master|main)$
8-
label: ''
8+
label: alpha
99
increment: Patch
1010

1111
ignore:

tests/OpenClaw.Tray.Tests/VersioningContractTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ public void ProductProjects_DoNotHardcodeReleaseVersion()
5858
string.Join(Environment.NewLine, offenders));
5959
}
6060

61+
[Fact]
62+
public void GitVersion_MainBranchPreservesAlphaReleaseTags()
63+
{
64+
var repoRoot = GetRepositoryRoot();
65+
var configPath = Path.Combine(repoRoot, "GitVersion.yml");
66+
var config = File.ReadAllText(configPath);
67+
var mainBranchMatch = Regex.Match(
68+
config,
69+
@"(?ms)^ main:\s*$\r?\n(?<body>.*?)(?=^ \S|\z)",
70+
RegexOptions.CultureInvariant);
71+
72+
Assert.True(mainBranchMatch.Success, "GitVersion.yml must configure the main branch.");
73+
Assert.Matches(
74+
@"(?m)^\s+label:\s*'?alpha'?\s*$",
75+
mainBranchMatch.Groups["body"].Value);
76+
}
77+
6178
[Fact]
6279
public void ActiveCodeAndTests_DoNotContainStaleReleaseVersion()
6380
{

0 commit comments

Comments
 (0)