Use next minor version with beta suffix for prereleases

- Changed prerelease versioning to increment minor version instead of using last tag
- Changed suffix from "preview" to "beta"
- Format is now {NEXT_MINOR_VERSION}-beta.{COMMIT_COUNT}
- Example: 0.43.0-beta.123 (if last tag is 0.42.x)
- Updated documentation in NUGET_RELEASE.md and TESTING.md

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-03 11:23:32 +00:00
parent d5913e8371
commit 9d6cd930ea
3 changed files with 13 additions and 9 deletions

View File

@@ -20,9 +20,9 @@ The workflow automatically determines the version based on whether the commit is
2. **Untagged Release (Prerelease)**:
- If the current commit is NOT tagged
- Creates a prerelease version based on the last tag
- Format: `{LAST_TAG}-preview.{COMMIT_COUNT}`
- Example: `0.42.1-preview.123`
- Creates a prerelease version based on the next minor version
- Format: `{NEXT_MINOR_VERSION}-beta.{COMMIT_COUNT}`
- Example: `0.43.0-beta.123` (if last tag is 0.42.x)
- Published as a prerelease to NuGet.org
### Workflow Steps
@@ -81,7 +81,7 @@ Consider enabling branch protection rules for the `release` branch to ensure:
```
2. The workflow will automatically:
- Build and test the project
- Publish a prerelease version like `0.42.1-preview.456` to NuGet.org
- Publish a prerelease version like `0.43.0-beta.456` to NuGet.org
## Troubleshooting

View File

@@ -26,7 +26,7 @@ This tests the workflow on untagged commits to the release branch.
4. Monitor the GitHub Actions workflow at: https://github.com/adamhathcock/sharpcompress/actions
5. Verify:
- Workflow triggers and runs successfully
- Version is determined correctly (e.g., `0.42.1-preview.XXX`)
- Version is determined correctly (e.g., `0.43.0-beta.XXX` if last tag is 0.42.x)
- Build and tests pass
- Package is uploaded as artifact
- Package is pushed to NuGet.org as prerelease
@@ -34,7 +34,7 @@ This tests the workflow on untagged commits to the release branch.
**Expected Outcome:**
- A new prerelease package appears on NuGet.org: https://www.nuget.org/packages/SharpCompress/
- Package version follows pattern: `{LAST_TAG}-preview.{COMMIT_COUNT}`
- Package version follows pattern: `{NEXT_MINOR_VERSION}-beta.{COMMIT_COUNT}`
### 2. Test Tagged Release Publishing
@@ -118,7 +118,7 @@ If testing produces unwanted packages:
The workflow is considered successful if:
- ✅ Prerelease versions are published correctly with preview suffix
- ✅ Prerelease versions are published correctly with beta suffix
- ✅ Tagged versions are published as stable releases
- ✅ GitHub releases are created for tagged versions
- ✅ Build and test failures prevent publishing

View File

@@ -280,7 +280,7 @@ static (string version, bool isPrerelease) GetVersion()
}
else
{
// Not tagged - create prerelease version based on last tag
// Not tagged - create prerelease version based on next minor version
var allTags = GetGitOutput("tag", "--list")
.Split('\n', StringSplitOptions.RemoveEmptyEntries)
.Where(tag => Regex.IsMatch(tag.Trim(), @"^\d+\.\d+\.\d+$"))
@@ -288,10 +288,14 @@ static (string version, bool isPrerelease) GetVersion()
.ToList();
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);
var commitCount = GetGitOutput("rev-list", "--count HEAD").Trim();
var version = $"{lastTag}-preview.{commitCount}";
var version = $"{nextVersion}-beta.{commitCount}";
Console.WriteLine($"Building prerelease version: {version}");
return (version, true);
}