/
PackContext.cs
37 lines (27 loc) · 1 KB
/
PackContext.cs
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
namespace BuildScripts;
public class PackContext
{
public string LibraryName { 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)
{
LibraryName = context.Arguments("libraryname", "X").FirstOrDefault()!;
LicensePath = context.Arguments("licensepath", "").FirstOrDefault()!;
Version = "1.0.0";
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");
}
}
}
}