Skip to content

Commit

Permalink
fix: bump message shows same version for prev and next Issue #78 (#81)
Browse files Browse the repository at this point in the history
* fix: moved bump statement up before csproj are altered

* test: add test to validate fix #81

Co-authored-by: Christian Günther <christian.guenther@photon-energy.de>
Co-authored-by: cabauman <cab452005@gmail.com>
  • Loading branch information
3 people committed Oct 1, 2022
1 parent c43d6f5 commit 59e4d76
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions Versionize.Tests/WorkingCopyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,25 @@ public void ShouldAggregatePrereleases()
Assert.Equal(sb.Build(), changelogContents);
}

[Fact]
public void ShouldDisplayExpectedMessage_BumpingVersionFromXToY()
{
TempProject.CreateCsharpProject(_testSetup.WorkingDirectory, "1.0.0");
var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

var fileCommitter = new FileCommitter(_testSetup);

// Release an initial version
fileCommitter.CommitChange("feat: initial commit");
workingCopy.Versionize(new VersionizeOptions());

// Patch release
fileCommitter.CommitChange("fix: a fix");
workingCopy.Versionize(new VersionizeOptions());

_testPlatformAbstractions.Messages.ShouldContain("√ bumping version from 1.0.0 to 1.0.1 in projects");
}

private IEnumerable<string> VersionTagNames
{
get { return _testSetup.Repository.Tags.Select(t => t.FriendlyName); }
Expand Down
5 changes: 3 additions & 2 deletions Versionize/WorkingCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ public SemanticVersion Versionize(VersionizeOptions options)

var versionTime = DateTimeOffset.Now;


Step($"bumping version from {projects.Version} to {nextVersion} in projects");

// Commit changelog and version source
if (!options.DryRun && (nextVersion != projects.Version))
{
Expand All @@ -147,8 +150,6 @@ public SemanticVersion Versionize(VersionizeOptions options)
}
}

Step($"bumping version from {projects.Version} to {nextVersion} in projects");

var changelog = ChangelogBuilder.CreateForPath(workingDirectory);
var changelogLinkBuilder = LinkBuilderFactory.CreateFor(repo);

Expand Down

0 comments on commit 59e4d76

Please sign in to comment.