1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:38:47 +00:00

[ci skip] ci(upm): output package.json instead of print to stdout

This commit is contained in:
Oliver Booth 2023-03-29 16:08:19 +01:00
parent 9ecbbee571
commit 34d1f859a7
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -7,17 +7,19 @@ if (args.Length == 0 || string.IsNullOrWhiteSpace(args[0]))
{
version = Environment.GetEnvironmentVariable("GITHUB_SHA") ?? "0.0.0";
}
string path = args[0];
var assembly = Assembly.LoadFrom(path);
var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
if (attribute is null || string.IsNullOrWhiteSpace(attribute.InformationalVersion))
{
version = Environment.GetEnvironmentVariable("GITHUB_SHA") ?? "0.0.0";
}
else
{
version = attribute.InformationalVersion;
string path = args[0];
var assembly = Assembly.LoadFrom(path);
var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
if (attribute is null || string.IsNullOrWhiteSpace(attribute.InformationalVersion))
{
version = Environment.GetEnvironmentVariable("GITHUB_SHA") ?? "0.0.0";
}
else
{
version = attribute.InformationalVersion;
}
}
var package = new
@ -33,4 +35,5 @@ var package = new
licensesUrl = "https://github.com/oliverbooth/X10D/blob/main/LICENSE.md"
};
Console.WriteLine(JsonSerializer.Serialize(package, new JsonSerializerOptions {WriteIndented = true}));
using FileStream outputStream = File.Create("package.json");
JsonSerializer.Serialize(outputStream, package, new JsonSerializerOptions {WriteIndented = true});