Merge branch 'dev' into dev

This commit is contained in:
DavidWang19
2023-05-03 21:36:33 +01:00
committed by GitHub
6 changed files with 1232 additions and 19 deletions

View File

@@ -50,7 +50,7 @@ jobs:
- id: set_tag
run: |
${{ startsWith(github.ref, 'refs/pull/') && 'cd temp' || '' }}
echo tag=$(git describe --tags ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
exit ${PIPESTATUS[0]}
- id: set_pre
@@ -65,9 +65,9 @@ jobs:
run: |
this_tag=${{ steps.set_tag.outputs.tag }}
if [[ '${{ steps.set_pre.outputs.prerelease }}' != 'false' ]]; then
last_tag=$(git describe --tags --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}')
last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}')
else
last_tag=$(git describe --tags --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}' --exclude='*-*')
last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}' --exclude='*-*')
fi
echo >> CHANGELOG.md
echo "**Full Changelog**: [$last_tag -> $this_tag](https://github.com/MaaAssistantArknights/MaaAssistantArknights/compare/${last_tag}...${this_tag})" >> CHANGELOG.md

File diff suppressed because it is too large Load Diff

View File

@@ -211,10 +211,10 @@ def main(tag_name=None, latest=None):
pass
# 从哪个 tag 开始
if latest == None:
latest = os.popen("git describe --abbrev=0 --tags").read().strip()
latest = os.popen("git describe --tags --match 'v*' --abbrev=0").read().strip()
if tag_name == None:
tag_name = os.popen("git describe --tags").read().strip()
tag_name = os.popen("git describe --tags --match 'v*'").read().strip()
print("From:", latest, ", To:", tag_name, "\n")
# 输出一张好看的 git log 图到控制台

View File

@@ -17,6 +17,7 @@ using System.Text.RegularExpressions;
using MaaBuilder.Models;
using static Nuke.Common.Tools.VSWhere.VSWhereTasks;
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Utilities.Collections;
namespace MaaBuilder;
@@ -169,12 +170,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;
}
@@ -198,8 +199,9 @@ public partial class Build
}
var ghEvent = b.GitHubActions.GitHubEvent;
Log.Information("GitHub Event{Event}", ghEvent.ToString());
if (ghEvent.ContainsKey("inputs"))
if (ghEvent.ContainsKey("inputs") && !ghEvent["inputs"].IsNullOrEmpty())
{
IsWorkflowDispatch = true;

View File

@@ -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}");

View File

@@ -4,7 +4,7 @@ LatestTagId=$(git rev-list --tags --max-count=1 --abbrev-commit)
LatestCommitId=$(git rev-list --all --max-count=1 --abbrev-commit)
if [ $LatestTagId = $LatestCommitId ]; then
Version=$(git describe --tags $LatestTagId)
Version=$(git describe --tags --match "v*" $LatestTagId)
else
Version="c""$LatestCommitId"
fi