Fix version parsing on github actions

This commit is contained in:
Harry 2022-01-26 20:15:07 +01:00 committed by GitHub
parent a4240b55c2
commit e9717cc073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,33 +17,7 @@ var list = new List<GAssembly>();
private void ParseVersion() private void ParseVersion()
{ {
if (!string.IsNullOrEmpty(EnvironmentVariable("GITHUB_ACTIONS"))) if (!string.IsNullOrEmpty(EnvironmentVariable("GITHUB_ACTIONS")))
{ Settings.Version = "3.24.24." + EnvironmentVariable("GITHUB_RUN_NUMBER");
var version = "3.24.24." + EnvironmentVariable("GITHUB_RUN_NUMBER");
var upstreamUrl = "GtkSharp/GtkSharp";
var repositoryUrl = EnvironmentVariable("GITHUB_REPOSITORY");
var branch = EnvironmentVariable("GITHUB_REF");
if (string.IsNullOrEmpty(repositoryUrl))
return;
if (repositoryUrl != upstreamUrl) // If we are building a PR
{
var split = repositoryUrl.Split('/');
version = version + "-" + split[0];
}
else if (repositoryUrl == upstreamUrl &&
!string.IsNullOrEmpty(branch) &&
branch != " refs/heads/master") // If we are building our repository
{
var branchName = branch.Substring(11);
version = version + "-" + branchName;
}
Settings.Version = version;
Console.WriteLine("Branch: " + branch);
}
Console.WriteLine("Version: " + Settings.Version); Console.WriteLine("Version: " + Settings.Version);
} }