-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPackContext.cs
More file actions
47 lines (34 loc) · 1.36 KB
/
PackContext.cs
File metadata and controls
47 lines (34 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using NuGet.Protocol.Core.Types;
namespace BuildScripts;
public class PackContext
{
public string ToolName { get; }
public string Description { get; }
public string ExecutableName { get; }
public string LicensePath { get; }
public string? RepositoryOwner { get; }
public string? RepositoryUrl { get; }
public string Version { get; }
public bool IsTag { get; }
public PackContext(ICakeContext context)
{
ToolName = context.Argument("toolname", "X");
ToolName = char.ToUpper(ToolName[0]) + ToolName[1..];
ExecutableName = context.Argument("executablename", "X");
LicensePath = context.Argument("licensepath", "");
Version = context.Argument("version", "1.0.0");
Description = $"This package contains executables for {ToolName} built for usage with MonoGame.";
RepositoryUrl = "X";
IsTag = false;
if (context.BuildSystem().IsRunningOnGitHubActions)
{
RepositoryOwner = context.EnvironmentVariable("GITHUB_REPOSITORY_OWNER");
RepositoryUrl = $"https://github.com/{context.EnvironmentVariable("GITHUB_REPOSITORY")}";
IsTag = context.EnvironmentVariable("GITHUB_REF_TYPE") == "tag";
if (IsTag)
{
Version = context.EnvironmentVariable("GITHUB_REF_NAME");
}
}
}
}