Skip to content

Create PreReleaseLabel and PreReleaseNumber #742 #753

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

Merged
merged 2 commits into from
Jan 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/more-info/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ For the `release/3.0.0` branch of GitVersion it shows:
"Patch":0,
"PreReleaseTag":"beta.1",
"PreReleaseTagWithDash":"-beta.1",
"PreReleaseLabel":"beta",
"PreReleaseNumber":1,
"BuildMetaData":1,
"BuildMetaDataPadded": "0001",
"FullBuildMetaData":"1.Branch.release/3.0.0.Sha.28c853159a46b5a87e6cc9c4f6e940c59d6bc68a",
Expand Down
2 changes: 2 additions & 0 deletions src/GitVersionCore.Tests/ExecuteCoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public void CacheFileExistsOnDisk()
Patch: 3
PreReleaseTag: test.19
PreReleaseTagWithDash: -test.19
PreReleaseLabel: test
PreReleaseNumber: 19
BuildMetaData:
BuildMetaDataPadded:
FullBuildMetaData: Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f
Expand Down
6 changes: 6 additions & 0 deletions src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@
<ItemGroup>
<Content Include="FodyWeavers.xml" />
<Content Include="JsonVersionBuilderTests.Json.approved.txt" />
<Content Include="VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreRelease.approved.txt" />
<Content Include="VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding.approved.txt" />
<Content Include="VariableProviderTests.ProvidesVariablesInContinuousDeliveryModeForStable.approved.txt" />
<Content Include="VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForPreRelease.approved.txt" />
<Content Include="VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStable.approved.txt" />
<Content Include="VariableProviderTests.ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged.approved.txt" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"unstable.4",
"PreReleaseTagWithDash":"-unstable.4",
"PreReleaseLabel":"unstable",
"PreReleaseNumber":4,
"BuildMetaData":5,
"BuildMetaDataPadded":"0005",
"FullBuildMetaData":"5.Branch.feature1.Sha.commitSha",
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore.Tests/TestableVersionVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestableVersionVariables : VersionVariables
{
public TestableVersionVariables(string major = "", string minor = "", string patch = "", string buildMetaData = "", string buildMetaDataPadded = "", string fullBuildMetaData = "", string branchName = "", string sha = "", string majorMinorPatch = "", string semVer = "", string legacySemVer = "", string legacySemVerPadded = "", string fullSemVer = "", string assemblySemVer = "", string preReleaseTag = "", string preReleaseTagWithDash = "", string informationalVersion = "", string commitDate = "", string nugetVersion = "", string nugetVersionV2 = "", string commitsSinceVersionSource = "", string commitsSinceVersionSourcePadded = "") : base(major, minor, patch, buildMetaData, buildMetaDataPadded, fullBuildMetaData, branchName, sha, majorMinorPatch, semVer, legacySemVer, legacySemVerPadded, fullSemVer, assemblySemVer, preReleaseTag, preReleaseTagWithDash, informationalVersion, commitDate, nugetVersion, nugetVersionV2, commitsSinceVersionSource, commitsSinceVersionSourcePadded)
public TestableVersionVariables(string major = "", string minor = "", string patch = "", string buildMetaData = "", string buildMetaDataPadded = "", string fullBuildMetaData = "", string branchName = "", string sha = "", string majorMinorPatch = "", string semVer = "", string legacySemVer = "", string legacySemVerPadded = "", string fullSemVer = "", string assemblySemVer = "", string preReleaseTag = "", string preReleaseTagWithDash = "", string preReleaseLabel = "", string preReleaseNumber = "", string informationalVersion = "", string commitDate = "", string nugetVersion = "", string nugetVersionV2 = "", string commitsSinceVersionSource = "", string commitsSinceVersionSourcePadded = "") : base(major, minor, patch, buildMetaData, buildMetaDataPadded, fullBuildMetaData, branchName, sha, majorMinorPatch, semVer, legacySemVer, legacySemVerPadded, fullSemVer, assemblySemVer, preReleaseTag, preReleaseTagWithDash, preReleaseLabel, preReleaseNumber, informationalVersion, commitDate, nugetVersion, nugetVersionV2, commitsSinceVersionSource, commitsSinceVersionSourcePadded)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"unstable.4",
"PreReleaseTagWithDash":"-unstable.4",
"PreReleaseLabel":"unstable",
"PreReleaseNumber":4,
"BuildMetaData":5,
"BuildMetaDataPadded":"0005",
"FullBuildMetaData":"5.Branch.develop.Sha.commitSha",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"unstable.4",
"PreReleaseTagWithDash":"-unstable.4",
"PreReleaseLabel":"unstable",
"PreReleaseNumber":4,
"BuildMetaData":5,
"BuildMetaDataPadded":"05",
"FullBuildMetaData":"5.Branch.develop.Sha.commitSha",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"",
"PreReleaseTagWithDash":"",
"PreReleaseLabel":"",
"PreReleaseNumber":"",
"BuildMetaData":5,
"BuildMetaDataPadded":"0005",
"FullBuildMetaData":"5.Branch.develop.Sha.commitSha",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"unstable.5",
"PreReleaseTagWithDash":"-unstable.5",
"PreReleaseLabel":"unstable",
"PreReleaseNumber":5,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.develop.Sha.commitSha",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"ci.5",
"PreReleaseTagWithDash":"-ci.5",
"PreReleaseLabel":"ci",
"PreReleaseNumber":5,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.develop.Sha.commitSha",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"Patch":3,
"PreReleaseTag":"",
"PreReleaseTagWithDash":"",
"PreReleaseLabel":"",
"PreReleaseNumber":"",
"BuildMetaData":5,
"BuildMetaDataPadded":"0005",
"FullBuildMetaData":"5.Sha.commitSha",
Expand Down
2 changes: 2 additions & 0 deletions src/GitVersionCore/OutputVariables/VariableProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public static VersionVariables GetVariablesFor(SemanticVersion semanticVersion,
semverFormatValues.AssemblySemVer,
semverFormatValues.PreReleaseTag,
semverFormatValues.PreReleaseTagWithDash,
semverFormatValues.PreReleaseLabel,
semverFormatValues.PreReleaseNumber,
informationalVersion,
semverFormatValues.CommitDate,
semverFormatValues.NuGetVersion,
Expand Down
6 changes: 6 additions & 0 deletions src/GitVersionCore/OutputVariables/VersionVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public VersionVariables(string major,
string assemblySemVer,
string preReleaseTag,
string preReleaseTagWithDash,
string preReleaseLabel,
string preReleaseNumber,
string informationalVersion,
string commitDate,
string nugetVersion,
Expand All @@ -50,6 +52,8 @@ public VersionVariables(string major,
AssemblySemVer = assemblySemVer;
PreReleaseTag = preReleaseTag;
PreReleaseTagWithDash = preReleaseTagWithDash;
PreReleaseLabel = preReleaseLabel;
PreReleaseNumber = preReleaseNumber;
InformationalVersion = informationalVersion;
CommitDate = commitDate;
NuGetVersion = nugetVersion;
Expand All @@ -63,6 +67,8 @@ public VersionVariables(string major,
public string Patch { get; private set; }
public string PreReleaseTag { get; private set; }
public string PreReleaseTagWithDash { get; private set; }
public string PreReleaseLabel { get; private set; }
public string PreReleaseNumber { get; private set; }
public string BuildMetaData { get; private set; }
public string BuildMetaDataPadded { get; private set; }
public string FullBuildMetaData { get; private set; }
Expand Down
10 changes: 10 additions & 0 deletions src/GitVersionCore/SemanticVersionFormatValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public string PreReleaseTagWithDash
get { return _semver.PreReleaseTag.HasTag() ? "-" + _semver.PreReleaseTag : null; }
}

public string PreReleaseLabel
{
get { return _semver.PreReleaseTag.HasTag() ? _semver.PreReleaseTag.Name : null; }
}

public string PreReleaseNumber
{
get { return _semver.PreReleaseTag.HasTag() ? _semver.PreReleaseTag.Number.ToString() : null; }
}

public string BuildMetaData
{
get { return _semver.BuildMetaData; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "4";
public static string PreReleaseTag = "beta.5";
public static string PreReleaseTagWithDash = "-beta.5";
public static string PreReleaseLabel = "beta";
public static string PreReleaseNumber = "5";
public static string BuildMetaData = "6";
public static string BuildMetaDataPadded = "0006";
public static string FullBuildMetaData = "6.Branch.master.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake
public static string Patch = "3";
public static string PreReleaseTag = "unstable.4";
public static string PreReleaseTagWithDash = "-unstable.4";
public static string PreReleaseLabel = "unstable";
public static string PreReleaseNumber = "4";
public static string BuildMetaData = "5";
public static string BuildMetaDataPadded = "0005";
public static string FullBuildMetaData = "5.Branch.feature1.Sha.commitSha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Fake.System
public static string Patch = "3";
public static string PreReleaseTag = "unstable.4";
public static string PreReleaseTagWithDash = "-unstable.4";
public static string PreReleaseLabel = "unstable";
public static string PreReleaseNumber = "4";
public static string BuildMetaData = "5";
public static string BuildMetaDataPadded = "0005";
public static string FullBuildMetaData = "5.Branch.feature1.Sha.commitSha";
Expand Down
6 changes: 6 additions & 0 deletions src/GitVersionTask/GetVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public GetVersion()
[Output]
public string PreReleaseTagWithDash { get; set; }

[Output]
public string PreReleaseLabel { get; set; }

[Output]
public string PreReleaseNumber { get; set; }

[Output]
public string BuildMetaData { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions src/GitVersionTask/NugetAssets/GitVersionTask.targets
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
<Output TaskParameter="NuGetVersion" PropertyName="GitVersion_NuGetVersion" />
<Output TaskParameter="PreReleaseTag" PropertyName="GitVersion_PreReleaseTag" />
<Output TaskParameter="PreReleaseTagWithDash" PropertyName="GitVersion_PreReleaseTagWithDash" />
<Output TaskParameter="PreReleaseLabel" PropertyName="GitVersion_PreReleaseLabel" />
<Output TaskParameter="PreReleaseNumber" PropertyName="GitVersion_PreReleaseNumber" />
<Output TaskParameter="InformationalVersion" PropertyName="GitVersion_InformationalVersion" />
<Output TaskParameter="CommitDate" PropertyName="GitVersion_CommitDate" />
<Output TaskParameter="CommitsSinceVersionSource" PropertyName="GitVersion_CommitsSinceVersionSource" />
Expand Down