mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 02:55:38 +08:00
chore: 尝试优化MaaBuilder一些有的没的
This commit is contained in:
@@ -169,12 +169,12 @@ public partial class Build
|
||||
if (b.GitHubActions.Ref.StartsWith(ReleaseTagRefPrefix))
|
||||
{
|
||||
var tag = $"v{b.GitHubActions.Ref.Replace(ReleaseTagRefPrefix, "")}";
|
||||
var pattern = @"v((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)";
|
||||
var pattern = @"^v((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)";
|
||||
var match = Regex.Match(tag, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
GhTag = tag;
|
||||
var preReleasePattern = @"v((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*))(-)";
|
||||
var preReleasePattern = @"^v((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*))(-)";
|
||||
var preReleaseMatch = Regex.Match(tag, preReleasePattern);
|
||||
IsPreRelease = preReleaseMatch.Success;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.Git;
|
||||
@@ -10,18 +10,18 @@ namespace MaaBuilder;
|
||||
|
||||
public partial class Build
|
||||
{
|
||||
Target UseRsVersion => _ => _
|
||||
private Target UseRsVersion => _ => _
|
||||
.Triggers(SetVersion)
|
||||
.Executes(() =>
|
||||
{
|
||||
Information($"Release Simulation: {Parameters.GhActionWdRsTagName}");
|
||||
|
||||
|
||||
Version = Parameters.GhActionWdRsTagName;
|
||||
|
||||
GitHubTasks.GitHubClient = new GitHubClient(new ProductHeaderValue(nameof(NukeBuild)));
|
||||
});
|
||||
|
||||
Target UseCommitVersion => _ => _
|
||||
|
||||
private Target UseCommitVersion => _ => _
|
||||
.Triggers(SetVersion)
|
||||
.Executes(() =>
|
||||
{
|
||||
@@ -29,7 +29,7 @@ public partial class Build
|
||||
Version = !envReleaseTag.IsNullOrEmpty() ? envReleaseTag : $"{Parameters.BuildTime}-{Parameters.CommitHash}";
|
||||
});
|
||||
|
||||
Target UseTagVersion => _ => _
|
||||
private Target UseTagVersion => _ => _
|
||||
.Triggers(SetVersion)
|
||||
.Executes(() =>
|
||||
{
|
||||
@@ -39,8 +39,8 @@ public partial class Build
|
||||
|
||||
var repo = GitRepository.FromLocalDirectory(RootDirectory);
|
||||
Assert.True(repo is not null, "不在 Git Repo 中");
|
||||
|
||||
var tag = repo.Tags.FirstOrDefault();
|
||||
|
||||
var tag = repo.Tags.ToList().Find(v => v.StartsWith("v"));
|
||||
|
||||
if (tag is not null)
|
||||
{
|
||||
@@ -63,12 +63,12 @@ public partial class Build
|
||||
};
|
||||
|
||||
LatestTag = Parameters.IsPreRelease ? GetLatestTag() : GetLatestReleaseTag();
|
||||
|
||||
|
||||
Version = Parameters.GhTag;
|
||||
}
|
||||
});
|
||||
|
||||
Target SetVersion => _ => _
|
||||
private Target SetVersion => _ => _
|
||||
.Executes(() =>
|
||||
{
|
||||
Information($"当前版本号设置为:{Version}");
|
||||
|
||||
Reference in New Issue
Block a user