mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-15 15:09:29 +00:00
Added BuildContext
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Cake.Common;
|
||||
using Cake.Common.Build;
|
||||
using Cake.Common.Xml;
|
||||
using Cake.Core;
|
||||
using Cake.Frosting;
|
||||
|
||||
namespace BuildScripts;
|
||||
|
||||
public sealed class BuildContext : FrostingContext
|
||||
{
|
||||
public string ArtifactsDirectory { get; }
|
||||
public string Version { get; }
|
||||
|
||||
public BuildContext(ICakeContext context) : base(context)
|
||||
{
|
||||
ArtifactsDirectory = context.Arguments(nameof(ArtifactsDirectory), "artifacts").FirstOrDefault();
|
||||
Version = context.XmlPeek("Directory.Build.targets", "/Project/PropertyGroup/Version");
|
||||
|
||||
if (context.BuildSystem().IsRunningOnGitHubActions)
|
||||
{
|
||||
Version += "." + context.EnvironmentVariable("GITHUB_RUN_NUMBER");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user