Files
MaaAssistantArknights/tools/MaaBuilder/Builder/Job/Build.Job.Publish.cs
2022-07-28 04:41:24 +08:00

42 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Nuke.Common;
using Nuke.Common.Tools.GitHub;
using Octokit;
namespace MaaBuilder;
public partial class Build
{
Target UsePublishArtifact => _ => _
.After(SetPackageBundled, SetMaaChangeLog)
.Produces(RootDirectory / "artifacts" / "*.*")
.OnlyWhenStatic(() => GitHubActions != null);
Target UsePublishRelease => _ => _
.After(UsePublishArtifact)
.OnlyWhenStatic(() => GitHubActions != null)
.Executes(() =>
{
Information("在 GitHub Actions 中运行,执行发布 Release 任务");
Information($"当前 Actions{Parameters.GhActionName}");
if (Parameters.GhActionName == ActionConfiguration.DevBuild)
{
Information("DevBuild 跳过发布 Release");
return;
}
GitHubTasks.GitHubClient ??= new GitHubClient(new ProductHeaderValue(nameof(NukeBuild)))
{
Credentials = new Credentials(Parameters.GitHubPersonalAccessToken)
};
// ReSharper disable once InvertIf
if (Parameters.GhActionName == ActionConfiguration.ReleaseMaa)
{
Information($"运行 ReleaseMaa 将在 {Parameters.MainRepo} 创建 Release {Parameters.GhTag}");
CreateGitHubRelease(Parameters.MainRepo, Parameters.CommitHashFull, Version);
}
});
}