Skip to content

Commit

Permalink
ci(upm): update package.json in upm branch (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Mar 29, 2023
1 parent 7a119fc commit 9ecbbee
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/nightly.yml
Expand Up @@ -48,6 +48,11 @@ jobs:
ref: upm
path: upm

- name: Build package.json
run: |
dotnet run --project ./X10D.UpmPackageGenerator/X10D.UpmPackageGenerator.csproj "./X10D/bin/Debug/netstandard2.1/X10D.dll"
cp package.json upm/package.json
- name: Commit update
run: |
cd upm
Expand All @@ -61,5 +66,6 @@ jobs:
git add X10D.Unity.dll
git add X10D.xml
git add X10D.Unity.xml
git add package.json
git commit -m "Update upm branch ($GITHUB_SHA)"
git push
6 changes: 6 additions & 0 deletions .github/workflows/prerelease.yml
Expand Up @@ -54,6 +54,11 @@ jobs:
ref: upm
path: upm

- name: Build package.json
run: |
dotnet run --project ./X10D.UpmPackageGenerator/X10D.UpmPackageGenerator.csproj "./X10D/bin/Release/netstandard2.1/X10D.dll"
cp package.json upm/package.json
- name: Commit update
run: |
cd upm
Expand All @@ -67,5 +72,6 @@ jobs:
git add X10D.Unity.dll
git add X10D.xml
git add X10D.Unity.xml
git add package.json
git commit -m "Update upm branch ($GITHUB_SHA)"
git push
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -54,6 +54,11 @@ jobs:
ref: upm
path: upm

- name: Build package.json
run: |
dotnet run --project ./X10D.UpmPackageGenerator/X10D.UpmPackageGenerator.csproj "./X10D/bin/Release/netstandard2.1/X10D.dll"
cp package.json upm/package.json
- name: Commit update
run: |
cd upm
Expand All @@ -67,5 +72,6 @@ jobs:
git add X10D.Unity.dll
git add X10D.xml
git add X10D.Unity.xml
git add package.json
git commit -m "Update upm branch ($GITHUB_SHA)"
git push
36 changes: 36 additions & 0 deletions X10D.UpmPackageGenerator/Program.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Text.Json;

string version;

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;
}

var package = new
{
name = "me.olivr.x10d",
author = new {name = "Oliver Booth", email = "me@olivr.me", url = "https://oliverbooth.dev"},
displayName = "X10D",
version,
unity = "2021.3",
description = "Extension methods on crack",
keywords = new[] {"dotnet", "extension-methods"},
changelogUrl = "https://github.com/oliverbooth/X10D/blob/main/CHANGELOG.md",
licensesUrl = "https://github.com/oliverbooth/X10D/blob/main/LICENSE.md"
};

Console.WriteLine(JsonSerializer.Serialize(package, new JsonSerializerOptions {WriteIndented = true}));
10 changes: 10 additions & 0 deletions X10D.UpmPackageGenerator/X10D.UpmPackageGenerator.csproj
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions X10D.sln
Expand Up @@ -41,6 +41,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{
.github\workflows\unity.yml = .github\workflows\unity.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X10D.UpmPackageGenerator", "X10D.UpmPackageGenerator\X10D.UpmPackageGenerator.csproj", "{CCBF047D-1B01-45EC-8D89-B00B4AC482CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -75,11 +77,17 @@ Global
{B04AF429-30CF-4B69-81BA-38F560CA9126}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B04AF429-30CF-4B69-81BA-38F560CA9126}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B04AF429-30CF-4B69-81BA-38F560CA9126}.Release|Any CPU.Build.0 = Release|Any CPU
{CCBF047D-1B01-45EC-8D89-B00B4AC482CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCBF047D-1B01-45EC-8D89-B00B4AC482CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCBF047D-1B01-45EC-8D89-B00B4AC482CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCBF047D-1B01-45EC-8D89-B00B4AC482CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6F733785-8837-410C-BD91-C4AD1F0A6914}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
EndGlobal

0 comments on commit 9ecbbee

Please sign in to comment.