Skip to content

Commit 85de654

Browse files
author
András Kurai
committed
Merge branch 'feature/remove-automatic-github-release' into develop
2 parents 177a4ce + b7adac8 commit 85de654

File tree

2 files changed

+0
-76
lines changed

2 files changed

+0
-76
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414

15-
- name: Create GitHub Release
16-
shell: pwsh
17-
run: ./build.ps1 CreateGithubRelease --is-ci
18-
1915
- name: Publish UnityResourceGenerator to OpenUPM
2016
uses: butlerlogic/action-autotag@stable
2117
with:

UnityResourceGenerator.Build/Build.cs

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
using Nuke.Common.IO;
33
using Nuke.Common.Tooling;
44
using Nuke.Common.Tools.MSBuild;
5-
using Nuke.Common.Utilities.Collections;
65
using System;
76
using System.IO;
8-
using System.Linq;
9-
using System.Text;
10-
using System.Text.Json;
117
using System.Text.RegularExpressions;
128
using System.Threading.Tasks;
139
using static Nuke.Common.Tools.DocFX.DocFXTasks;
14-
using static Nuke.Common.Tools.Git.GitTasks;
1510
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
1611
using static Nuke.Common.Tools.Unity.UnityTasks;
1712
using static UnityHelper;
@@ -22,8 +17,6 @@ class Build : NukeBuild
2217

2318
public static int Main() => Execute<Build>(x => x.Compile);
2419

25-
[PathExecutable] readonly Tool Gh = default!;
26-
2720
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
2821
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
2922

@@ -33,9 +26,6 @@ class Build : NukeBuild
3326

3427
[Parameter("Are we running in CI")] bool IsCi = false;
3528

36-
string CurrentVersion { get; set; } = default!;
37-
bool IsNewestVersion { get; set; }
38-
3929
static AbsolutePath UnityProjectPath => RootDirectory / "UnityResourceGenerator";
4030
static AbsolutePath UnitySolution => UnityProjectPath / "UnityResourceGenerator.sln";
4131

@@ -123,66 +113,4 @@ async Task GenerateSolution()
123113
Target ServeDocs => _ => _
124114
.DependsOn(BuildDocs)
125115
.Executes(() => DocFX($"{DocFxJsonPath} --serve"));
126-
127-
Target CreateGithubRelease => _ => _
128-
.OnlyWhenDynamic(() => IsNewestVersion)
129-
.OnlyWhenDynamic(() => IsCi)
130-
.Executes(() =>
131-
{
132-
var version = CurrentVersion;
133-
134-
var notes = File.ReadAllLines(RootDirectory / "CHANGELOG.md")
135-
.Skip(1)
136-
.TakeUntil(string.IsNullOrWhiteSpace)
137-
.Aggregate(new StringBuilder(), (sb, l) => sb.AppendLine(l))
138-
.ToString();
139-
140-
Gh($"release create {version} -t {version} -n \"{notes}\"");
141-
});
142-
143-
144-
protected override void OnBuildInitialized()
145-
{
146-
bool GetIsNewestVersion()
147-
{
148-
var currentVersion = new Version(CurrentVersion);
149-
150-
GitLogger = (_, s) => Logger.Info(s);
151-
152-
Git("fetch --tags");
153-
154-
var maxPublishedVersion = Git("tag")
155-
.Select(o => new Version(o.Text))
156-
.OrderBy(v => v)
157-
.LastOrDefault();
158-
159-
return currentVersion.CompareTo(maxPublishedVersion) > 0;
160-
}
161-
162-
string GetCurrentVersion()
163-
{
164-
var packagePath = UnityProjectPath / "Assets" / "AutSoft.UnityResourceGenerator" / "package.json";
165-
166-
if (!File.Exists(packagePath)) throw new InvalidOperationException($"package.json does not exist at path: {packagePath}");
167-
168-
var jsonContent = File.ReadAllText(packagePath);
169-
var package = JsonSerializer.Deserialize<PackageJson>(jsonContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
170-
171-
if (package?.Version is null) throw new InvalidOperationException($"Cloud not deserialize package.json:{Environment.NewLine}{jsonContent}");
172-
173-
return package.Version;
174-
}
175-
176-
CurrentVersion = GetCurrentVersion();
177-
IsNewestVersion = GetIsNewestVersion();
178-
179-
base.OnBuildInitialized();
180-
}
181-
182-
sealed class PackageJson
183-
{
184-
public PackageJson(string version) => Version = version;
185-
186-
public string Version { get; }
187-
}
188116
}

0 commit comments

Comments
 (0)