Skip to content

[ISSUE]: Main/release branch always adds a prerelease tag. #4179

@toadicusrex

Description

@toadicusrex

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

6.0.2

Operating system

Linux, Windows

What are you seeing?

I have tried a crazy number of combinations, but my main branch which should never have prerelease tags is adding prerelease tags every time I commit, unless I also manually commit a version tag (i.e. "v3.5.0"), which it then uses to create a tag like "3.5.0" on the same commit. I grant that this might have something to do with my setup but it behaves the same in both Azure Devops as well as GitHub Actions, and on my own development machine. This worked with version 5.x of GitVersion, but now I've upgraded and I'm hoping to find a quick solution so that my main branch pipeline runs produce release tags without manual intervention (manually adding a release tag). This is related to #4175 I think.

What is expected?

Release branches don't produce gitversion values with prerelease tags. All other branches should build tags with prerelease tags, and they should version based only on version tags and/or commit messages in their direct ancestry (i.e. should not pull highest build version from main unless that version tag is in the same direct ancestry).

Note that I want ContinuousDelivery, not ContinuousDeployment. I want a new version on every commit to master/main, I just want it to not have prerelease tags.

I'm going to try to do a PR if I can figure this out, but I'm hoping I've just made a mistake and I misconfigured it.

Steps to Reproduce

I might be flailing a bit, but here's my config:

assembly-versioning-scheme: MajorMinorPatchTag
assembly-file-versioning-scheme: MajorMinorPatchTag
tag-prefix: '[vV]?'
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
tag-pre-release-weight: 60000
commit-date-format: yyyy-MM-dd
merge-message-formats: {}
update-build-number: true
semantic-version-format: Loose
strategies:
- Fallback
- MergeMessage
- TrackReleaseBranches
- VersionInBranchName
- Mainline
branches:
    main:
        mode: ContinuousDelivery
        label: ''
        increment: Patch    
        prevent-increment:
                of-merged-branch: false
        track-merge-target: false
        track-merge-message: false
        regex: ^master$|^main$
        source-branches: []
        is-source-branch-for: []
        tracks-release-branches: false
        is-release-branch: false
        is-main-branch: true
    release:
            mode: ContinuousDelivery
        label: '{BranchName}'
        increment: none
        prevent-increment:
            when-current-commit-tagged: false
        track-merge-message: false
        tracks-release-branches: false
        track-merge-target: false
        regex: (?<BranchName>.+)
        source-branches: []
        is-source-branch-for: []
        tracks-release-branches: false
        is-release-branch: false
        is-main-branch: false
ignore:
    sha: []
mode: ContinuousDelivery
label: '{BranchName}'
increment: Inherit
prevent-increment:
    of-merged-branch: false
    when-branch-merged: false
    when-current-commit-tagged: true
track-merge-target: false
track-merge-message: true
commit-message-incrementing: Enabled
regex: ''
source-branches: []
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-main-branch: false

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions