Create DeployToGithubTask

This commit is contained in:
Christopher Whitley
2023-11-16 13:19:23 -05:00
committed by GitHub
parent 5403441e02
commit 809b525e43
+25
View File
@@ -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<BuildContext>
{
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);
}
}