Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support incrementing semver prereleases with 'zero' versions #9668

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

hallipr
Copy link
Member

@hallipr hallipr commented Jan 21, 2025

  • Remove the artificial PrereleaseLabel and PrereleaseNumber values from non-prerelease versions
  • Add support for bumping Major, Minor or Patch versions using IncrementAndSetToPrerelease($segment)
    • The default segment is still minor
  • Fix support for "zero" versions in HasValidPrereleaseLabel
    • previously, [AzureEngSemanticVersion]::new("0.1.2").HasValidPrereleaseLabel() would return
      Unexpected pre-release identifier 'zzz',  should be 'beta' or 'alpha'
      False
      

Parse results before:

Property 0.1.2 1.2.3 1.2.3-alpha.1 1.2.3-alpha.20250121.10
Major 0 1 1 1
Minor 1 2 2 2
Patch 2 3 3 3
PrereleaseLabel zzz zzz alpha alpha
BuildNumber 10
PrereleaseNumber 99999999 99999999 1 20250121
IsPrerelease True False True True
VersionType Beta Patch Beta Beta

Parse results after change:

Property 0.1.2 1.2.3 1.2.3-alpha.1 1.2.3-alpha.20250121.10
Major 0 1 1 1
Minor 1 2 2 2
Patch 2 3 3 3
PrereleaseLabel alpha alpha
BuildNumber 10
PrereleaseNumber 0 0 1 20250121
IsPrerelease True False True True
VersionType Beta Patch Beta Beta

@hallipr hallipr requested a review from a team as a code owner January 21, 2025 18:56
@hallipr hallipr force-pushed the users/pahallis/semver-bump branch from ee9e4e2 to afc11f4 Compare January 21, 2025 18:58
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@hallipr
Copy link
Member Author

hallipr commented Jan 21, 2025

The only code that depends on the artificial values appears to be:
https://github.com/Azure/azure-sdk-for-go/blob/main/eng/scripts/Update-ModuleVersion.ps1#L43

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@hallipr
Copy link
Member Author

hallipr commented Jan 21, 2025

azd is manually incrementing versions and could move to the new overload:
https://github.com/Azure/azure-dev/blob/88ad9bc2cf8e63ef6e0e6b4577770127a162fc3d/eng/scripts/Update-CliVersion.ps1#L24

    if ($version.IsPrerelease) {
        if ($version.HasValidPrereleaseLabel()) {
            # 0.1.0-beta.1 -> 0.1.0-beta.2
            # 1.0.0-beta.1 -> 1.0.0-beta.2
            $version.PrereleaseNumber++
        } else {
            # 0.1.0 -> 0.2.0-beta.1
            $version.Minor++
            $version.PrereleaseLabel = 'beta'
            $version.PrereleaseNumber = 1
        }
    } else {
        # 1.0.0 -> 1.1.0-beta.1
        $version.IncrementAndSetToPrerelease()
    }

Copy link
Member

@weshaggard weshaggard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be sure to look at the existing usages and fix any that are broken by this change or that can now use your changes.

@hallipr hallipr enabled auto-merge (squash) January 22, 2025 18:38
azure-sdk added a commit to Azure/azure-sdk-for-js that referenced this pull request Jan 22, 2025
@hallipr hallipr merged commit 4566d3a into Azure:main Jan 22, 2025
12 checks passed
@hallipr hallipr deleted the users/pahallis/semver-bump branch January 30, 2025 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants