Autoincrement your NuGet using FAKE
Sometimes in a company we can have several small internal library projects. Then, we don’t want to maintain a verbose release note for each of them and the version numbering must be as less restrictive as possible
I this case I use a FAKE.NuGetVersion module to auto increment my nugets packages versions.
For example, we can get current published version of FAKE nuget with:
NuGetVersion.getLastNuGetVersion (NuGetVersionArg.Default().Server) "FAKE"
Result is:
val it : SemVerInfo option = Some {Major = 4;
Minor = 14;
Patch = 3;
PreRelease = null;
Build = "";}
To auto increment a nuget, we can do this:
NuGet (fun p ->
{p with
// Other settings truncated ....
Project = "MyProject"
Title = "MyProject"
Version =
NuGetVersion.nextVersion (
fun arg -> { arg with PackageName="MyProject" })
})
"MyProject.nuspec"
We can choose increment method with:
NuGetVersion.nextVersion <|
fun arg ->
{ arg
with
PackageName="FAKE"
Increment=NuGetVersion.IncPatch
}
//val it : string = "4.14.5"
NuGetVersion.nextVersion <|
fun arg ->
{ arg
with
PackageName="FAKE"
Increment=NuGetVersion.IncMinor
}
//val it : string = "4.15.0"
NuGetVersion.nextVersion <|
fun arg ->
{ arg
with
PackageName="FAKE"
Increment=NuGetVersion.IncMajor
}
//val it : string = "5.0.0"
100%