-
Notifications
You must be signed in to change notification settings - Fork 654
change prerelease tag to local.timestamp when building locally #2069
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
Changes from all commits
0508819
7f70435
95076a8
7c21ec6
1babc52
aac0f92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
using GitVersion.Configuration; | ||
using GitVersion.Logging; | ||
using GitVersion.Extensions; | ||
using LibGit2Sharp; | ||
|
||
namespace GitVersion.VersionCalculation | ||
{ | ||
|
@@ -77,6 +78,12 @@ public SemanticVersion FindVersion(GitVersionContext context) | |
} | ||
} | ||
|
||
if (context.IsLocalBuild && taggedSemanticVersion == null && context.Repository.RetrieveStatus().IsDirty) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is why this is superior to our current solution we have with our own msbuild target. cc @zionyx There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though I wonder if that's what we want. |
||
{ | ||
var tagToUse = $"local.{DateTime.Now:yyyyMMddHHmmss}"; | ||
semver.PreReleaseTag = new SemanticVersionPreReleaseTag(tagToUse, null); | ||
} | ||
|
||
return taggedSemanticVersion ?? semver; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,8 @@ public void RunExecViaCommandLine() | |
var result = GitVersionHelper.ExecuteIn(fixture.RepositoryPath, ExecCommand.BuildTool, "RunExecViaCommandLine.csproj /target:OutputResults"); | ||
|
||
result.ExitCode.ShouldBe(0, result.Log); | ||
result.Log.ShouldContain("GitVersion_FullSemVer: 1.2.4+1"); | ||
var now = DateTime.Now.ToString("yyyyMMddHH"); | ||
result.Log.ShouldMatch($".+GitVersion_FullSemVer: 1.2.4-local.{now}\\d+\\+1.+"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great we already had a test that constituted as a dirty repo 😍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should properly add a dirty one and none dirty? to see when build is local 👍 |
||
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we stick to either
isLocalBuild
orisCiBuild
to avoid confusion?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was indecisive on wording I think
isLocalBuild
is best. I must have missed this one.