diff --git a/.github/workflows/NUGET_RELEASE.md b/.github/workflows/NUGET_RELEASE.md index bff4c37f..56cd874e 100644 --- a/.github/workflows/NUGET_RELEASE.md +++ b/.github/workflows/NUGET_RELEASE.md @@ -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 diff --git a/.github/workflows/TESTING.md b/.github/workflows/TESTING.md index 89d0d1e3..af9044d5 100644 --- a/.github/workflows/TESTING.md +++ b/.github/workflows/TESTING.md @@ -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 diff --git a/build/Program.cs b/build/Program.cs index dc8c11f3..40c19b4a 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -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); }