Skip to content
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

Integrate logic from AppVeyor into build script #111

Merged
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
16 changes: 14 additions & 2 deletions build/build.cake
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#addin nuget:?package=Cake.Git&version=0.22.0
#addin nuget:?package=Cake.Npm&version=0.17.0
#addin nuget:?package=Cake.Tfx&version=0.9.1

#addin nuget:?package=Newtonsoft.Json&version=12.0.3

#tool nuget:?package=ILRepack&version=2.0.18

using System.Text.RegularExpressions;
using System.Linq;

// Helpers

Func<string, string> resolveFilePath = (string source) => MakeAbsolute(File(source)).ToString();
Expand All @@ -14,8 +18,16 @@ Func<string, string> resolveDirectoryPath = (string source) => MakeAbsolute(Dire

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = Argument("versionnumber", "0.0.0");
var versionbuild = Argument("versionbuild", "0");
var versionbuild = EnvironmentVariable("appveyor_build_version", "0");

var tags = GitTags(resolveDirectoryPath("./../"));
var lastTag = tags.Last();
var matches = Regex.Matches(lastTag.ToString(), "v([0-9\\.]+)", RegexOptions.IgnoreCase);
var version = "0.0.0";
if (matches[0].Success && matches[0].Groups.Count > 1)
{
version = matches[0].Groups[1].Value;
}

// Variables

Expand Down