From f16a6e765e0135b115fcd1fb7bcd7544aca5c09a Mon Sep 17 00:00:00 2001 From: Benito Palacios Sanchez Date: Thu, 23 Nov 2023 13:10:02 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20GitHub=20binary=20upload?= =?UTF-8?q?=20using=20dotnet-tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GitHub/UploadReleaseBinariesTask.cs | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Cake.Frosting.PleOps.Recipe/GitHub/UploadReleaseBinariesTask.cs b/src/Cake.Frosting.PleOps.Recipe/GitHub/UploadReleaseBinariesTask.cs index b5c46bf..305355d 100644 --- a/src/Cake.Frosting.PleOps.Recipe/GitHub/UploadReleaseBinariesTask.cs +++ b/src/Cake.Frosting.PleOps.Recipe/GitHub/UploadReleaseBinariesTask.cs @@ -19,7 +19,9 @@ // SOFTWARE. namespace Cake.Frosting.PleOps.Recipe.GitHub; -using Cake.Common.Tools.GitReleaseManager; +using System.Text; +using Cake.Common.Tools.DotNet; +using Cake.Core.Diagnostics; using Cake.Frosting; /// @@ -42,13 +44,19 @@ public override bool ShouldRun(PleOpsBuildContext context) => public override void Run(PleOpsBuildContext context) { string tagName = $"v{context.Version}"; - foreach (string artifact in context.DeliveriesContext.BinaryFiles) { - context.GitReleaseManagerAddAssets( - context.GitHubContext.GitHubToken, - context.GitHubContext.RepositoryOwner, - context.GitHubContext.RepositoryName, - tagName, - artifact); - } + string artifacts = string.Join( + ",", + context.DeliveriesContext.BinaryFiles.Select(x => $"\"{x}\"")); + + context.Log.Information("Uploading assets: {0}", artifacts); + string args = new StringBuilder().Append("addasset ") + .AppendFormat(" --tagName {0}", tagName) + .AppendFormat(" --token {0}", context.GitHubContext.GitHubToken) + .AppendFormat(" --owner {0}", context.GitHubContext.RepositoryOwner) + .AppendFormat(" --repository {0}", context.GitHubContext.RepositoryName) + .AppendFormat(" --assets {0}", artifacts) + .ToString(); + + context.DotNetTool("dotnet-gitreleasemanager " + args); } }