Skip to content

Make GitVersion ignore tags; bump next-version to 1.1.0#89

Merged
mkrueger merged 3 commits into
mainfrom
dev/mkrueger/gitversion-ignore-tags
May 20, 2026
Merged

Make GitVersion ignore tags; bump next-version to 1.1.0#89
mkrueger merged 3 commits into
mainfrom
dev/mkrueger/gitversion-ignore-tags

Conversation

@mkrueger
Copy link
Copy Markdown
Contributor

@mkrueger mkrueger commented May 20, 2026

Why

The latest build dropped from 1.0.273 back to 1.0.82. Root cause: GitVersion's default strategies list includes TaggedCommit, which picks any matching version tag (e.g. v1.0.273) as the "version source" and resets the commit count from there. Once v1.0.273 was tagged, the patch counter snapped back from 273 to "commits since that tag" (= 82), so the next build was lower than the previous one.

What

Single change: in GitVersion.yml, override the strategies list to omit TaggedCommit, and bump next-version to 1.1.0.

strategies:
  - Fallback
  - ConfiguredNextVersion
  - TrackReleaseBranches
  - VersionInBranchName

next-version: 1.1.0

GitVersion now never considers any tag as a version source, so the build version depends only on next-version (for Major.Minor) and commit count (for the patch). The pipeline scripts and tool manifest are unchanged.

Properties of the new scheme

  • Tag-independent: creating, renaming, or deleting tags does not affect the build version.
  • Monotonic going forward: 1.1.x is strictly greater than any earlier 1.0.x value, including 1.0.273.
  • Explicit bumps: changing next-version is still the supported way to start a new release line.

Verification

  • Locally on this branch: dotnet tool run dotnet-gitversion reports 1.1.357 (357 = CommitsSinceVersionSource, no tagged-commit source picked).
  • No pipeline / source code / test changes — only GitVersion.yml.

…1.1.0

The previous pipeline used GitVersion's CommitsSinceVersionSource, which treats any matching version tag (e.g. v1.0.273) as the version source. That made the patch number reset whenever such a tag was created, so the latest build went from 1.0.273 back down to 1.0.82.

Compute Major.Minor directly from next-version in GitVersion.yml and the patch number as the count of commits since that file was last modified. The version is now tag-independent and monotonically increasing within a release line.

Also bump next-version to 1.1.0 so new builds start at 1.1.x, comfortably above the previous 1.0.273 high-water mark.
@mkrueger mkrueger requested review from a team and Copilot May 20, 2026 13:01
@mkrueger mkrueger enabled auto-merge May 20, 2026 13:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the build/versioning strategy so CI-generated versions are derived solely from GitVersion.yml (ignoring git tags), and bumps the release line to 1.1.x via next-version: 1.1.0.

Changes:

  • Update GitVersion.yml documentation and bump next-version to 1.1.0.
  • Replace GitVersion tool invocation in GitHub Actions and OneBranch pipelines with parsing next-version + counting commits since GitVersion.yml last changed.
  • Remove GitVersion from the local dotnet tool manifest.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
GitVersion.yml Documents the new tag-independent scheme and bumps next-version to 1.1.0.
.pipelines/CosmosDB-Shell-Official.yml Computes version from GitVersion.yml + git commit count (replacing dotnet-gitversion).
.github/workflows/validate-and-package.yml Computes version properties in CI using the new GitVersion.yml-based logic and removes GitVersion tool restore.
.config/dotnet-tools.json Drops gitversion.tool from the local tool manifest.

Comment thread .pipelines/CosmosDB-Shell-Official.yml Outdated
Comment thread .github/workflows/validate-and-package.yml Outdated
mkrueger added 2 commits May 20, 2026 15:16
…o 1.1.0

Override GitVersion's 'strategies' list to omit TaggedCommit so tags such as 'v1.0.273' no longer reset CommitsSinceVersionSource. The previous behavior caused the build version to go backwards (1.0.273 -> 1.0.82) after the tag was created.

Also bump next-version to 1.1.0 so new builds start at 1.1.x, comfortably above the previous 1.0.273 high-water mark. Locally GitVersion now reports 1.1.357 on this branch.
@mkrueger mkrueger changed the title Make build version depend only on GitVersion.yml (not tags); bump to 1.1.0 Make GitVersion ignore tags; bump next-version to 1.1.0 May 20, 2026
@mkrueger mkrueger merged commit d1e5a12 into main May 20, 2026
8 checks passed
@mkrueger mkrueger deleted the dev/mkrueger/gitversion-ignore-tags branch May 20, 2026 13:30
mkrueger added a commit that referenced this pull request May 20, 2026
…r.Minor) (#90)

## Why

PR #89 made the build version independent of git tags by removing the
`TaggedCommit` strategy from `GitVersion.yml`. That fixed the regression
where tagging `v1.0.273` reset the patch to `82`. However, GitVersion's
`ConfiguredNextVersion` strategy returns `next-version` from the config
file but **does not set a base version SHA**, so
`CommitsSinceVersionSource` falls back to counting all commits in the
repository.

Result: after merging #89, builds show `1.1.357+` instead of starting at
`1.1.0` after the `next-version` bump. The patch never resets when
`next-version` is bumped, which makes a `Major.Minor` bump
indistinguishable from any other commit.

## What

Keep GitVersion responsible for parsing/validating `Major.Minor` from
`GitVersion.yml`, but compute the patch in both pipelines from the
commit history of `GitVersion.yml` itself:

```pwsh
$configCommit = (git log -n 1 --format=%H -- $configPath).Trim()
$patch = [int](git rev-list --count "$configCommit..HEAD")
```

Applied identically in:

- `.github/workflows/validate-and-package.yml`
- `.pipelines/CosmosDB-Shell-Official.yml`

## Behavior

- Tag-independent (matches the goal of #89).
- Patch resets to `0` whenever `GitVersion.yml` is edited (e.g. when
bumping `next-version`).
- Subsequent commits after a bump produce `1.1.1`, `1.1.2`, … in order.
- The next bump (say to `1.2.0`) automatically resets the counter back
to `0`.

Note: the very first build after this PR merges will be `1.1.<small>`
rather than literally `1.1.0`, because the merge commit and any commits
between #89 and this PR are counted from `GitVersion.yml`'s last edit
(commit `319b304` from #89). Future `next-version` bumps will reset
cleanly because they touch `GitVersion.yml`.

## Validation

```text
GitVersion Major.Minor: 1.1
Config commit: 319b304
Final version: 1.1.<commits-since-bump>
```

`dotnet build CosmosDBShell/CosmosDBShell.csproj` succeeds locally.
mkrueger added a commit that referenced this pull request May 21, 2026
Converts the `Unreleased — since v1.0.273` section to `1.1.4 —
2026-05-21` (first release on the 1.1 line) and adds entries for the PRs
that landed after #86 (the last CHANGELOG update):

- **Highlights / New features:** multi-line REPL input with `\`
continuation and parser-driven incomplete-input detection
([#88](#88)); parser & query
diagnostics with line, column, source caret, and "Did you mean…"
suggestions ([#87](#87)).
- **Documentation:** notes that [docs/navigation.md](docs/navigation.md)
and [README](README.md) now document multi-line input.
- **Build & pipeline:** versioning moved to
[Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning);
local builds now produce the same versions as CI
([#90](#90),
[#91](#91)).

PR #89 was a stepping stone superseded by the NBGV migration, so it
isn't called out separately.

Docs-only change — no code touched.
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