chore: improves next version selection

This commit is contained in:
Matthias Langhard
2021-11-03 08:23:41 +01:00
parent 0ca934cfa8
commit 808f0e4564
5 changed files with 75 additions and 14 deletions

View File

@@ -9,7 +9,7 @@
<PackageId>Novaloop.UpdateTag</PackageId>
<title>Updates the tag of a repo to the next chosen version according the semver symantic.</title>
<PackageTags>semver;update-tag;tag;git</PackageTags>
<Version>0.1.4</Version>
<Version>0.1.5</Version>
<Authors>Matthias Langhard</Authors>
<Company>Novaloop AG</Company>
<PackageProjectUrl>https://gitlab.com/novaloop-oss/novaloop.update-tag</PackageProjectUrl>

View File

@@ -141,7 +141,7 @@ namespace Application.Models
return nextVersion;
}
public Version CreateRc()
public Version CreatePatchRc()
{
if (Rc != null)
{
@@ -149,6 +149,36 @@ namespace Application.Models
}
var nextVersion = Copy();
nextVersion.Patch++;
nextVersion.Rc = 0;
return nextVersion;
}
public Version CreateMinorRc()
{
if (Rc != null)
{
throw new ArgumentException("Cannot create RC. Already an RC.");
}
var nextVersion = Copy();
nextVersion.Minor++;
nextVersion.Patch = 0;
nextVersion.Rc = 0;
return nextVersion;
}
public Version CreateMajorRc()
{
if (Rc != null)
{
throw new ArgumentException("Cannot create RC. Already an RC.");
}
var nextVersion = Copy();
nextVersion.Major++;
nextVersion.Minor = 0;
nextVersion.Patch = 0;
nextVersion.Rc = 0;
return nextVersion;
}

View File

@@ -14,10 +14,12 @@ namespace Application.Models
}
else
{
NextVersions.Add(new NextVersion("rc", currentVersion.CreateRc()));
NextVersions.Add(new NextVersion("patch", currentVersion.NextPatch()));
NextVersions.Add(new NextVersion("minor", currentVersion.NextMinor()));
NextVersions.Add(new NextVersion("major", currentVersion.NextMajor()));
NextVersions.Add(new NextVersion("patch-rc", currentVersion.CreatePatchRc()));
NextVersions.Add(new NextVersion("minor-rc", currentVersion.CreateMinorRc()));
NextVersions.Add(new NextVersion("minor-rc", currentVersion.CreateMajorRc()));
NextVersions.Add(new NextVersion("patch ", currentVersion.NextPatch()));
NextVersions.Add(new NextVersion("minor ", currentVersion.NextMinor()));
NextVersions.Add(new NextVersion("major ", currentVersion.NextMajor()));
}
}