feat(scm_provider): add branch-based version retrieval #1155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The get_version function within the ScmProvider class has been enhanced to include branch-specific version retrieval capabilities. This update introduces the optional branch_prerelease_map configuration, allowing users to link branch names to specific release types (e.g., "b" for beta, "rc" for release candidate). This feature provides targeted version management suitable for different stages of the release workflow while ensuring backward compatibility by defaulting to the highest semver tag when no branch map is provided.
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
Upon defining a branch_prerelease_map in the project configuration, the get_version function should retrieve the latest version number based on the current branch and its associated release type. If no map is provided, the function will revert to fetching the highest semver tag across all branches, maintaining functionality for existing setups.
Steps to Test This Pull Request
pyrpoject.toml
with abranch_prerelease_map
(see below example)Additional context
This enhancement aligns with evolving development practices requiring more granular control over version management across multiple branches, particularly in environments employing CI/CD pipelines for automated release management.
Example pyproject.toml