Skip to content

Commit

Permalink
Merge pull request #78 from pleonex/feature/fix-uploadbin
Browse files Browse the repository at this point in the history
🐛 Fix GitHub binary upload using dotnet-tools
  • Loading branch information
pleonex authored Nov 23, 2023
2 parents 1a46c6f + f16a6e7 commit 0b5849b
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand All @@ -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);
}
}

0 comments on commit 0b5849b

Please sign in to comment.