From 809b525e43d1212b9346eb152e8eb06f5e92f293 Mon Sep 17 00:00:00 2001 From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:19:23 -0500 Subject: [PATCH] Create DeployToGithubTask --- build/DeployToGithubTask.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 build/DeployToGithubTask.cs diff --git a/build/DeployToGithubTask.cs b/build/DeployToGithubTask.cs new file mode 100644 index 00000000..62981e79 --- /dev/null +++ b/build/DeployToGithubTask.cs @@ -0,0 +1,25 @@ +using Cake.Common.Tools.DotNet; +using Cake.Common.Tools.DotNet.NuGet.Push; +using Cake.Frosting; + +namespace BuildScripts; + +[TaskName(nameof(DeployToGitHubTask))] +public sealed class DeployToGitHubTask : FrostingTask +{ + public override bool ShouldRun(BuildContext context) + { + return context.IsRunningOnGitHubActions; + } + + public override void Run(BuildContext context) + { + DotNetNuGetPushSettings pushSettings = new DotNetNuGetPushSettings() + { + Source = $"https://nuget.pkg.github.com/{context.RepositoryOwner}/index.json", + ApiKey = context.GitHubToken + }; + + context.DotNetNuGetPush("artifacts/*.nupkg", pushSettings); + } +}