mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
better abstract
This commit is contained in:
@@ -46,11 +46,6 @@ variables:
|
|||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- task: GetRevision@1
|
|
||||||
displayName: get Pipelines revision number
|
|
||||||
inputs:
|
|
||||||
VariableName: 'rev_number'
|
|
||||||
|
|
||||||
- task: UseDotNet@2
|
- task: UseDotNet@2
|
||||||
displayName: Install dotNet
|
displayName: Install dotNet
|
||||||
inputs:
|
inputs:
|
||||||
@@ -61,7 +56,7 @@ steps:
|
|||||||
- task: CmdLine@2
|
- task: CmdLine@2
|
||||||
displayName: dotnet cake
|
displayName: dotnet cake
|
||||||
inputs:
|
inputs:
|
||||||
script: dotnet tool restore && dotnet cake --Version=$(build_date).$(rev_number) --pw=$(pw)
|
script: dotnet tool restore && dotnet cake --pw=$(pw)
|
||||||
|
|
||||||
- task: DownloadSecureFile@1
|
- task: DownloadSecureFile@1
|
||||||
name: cerFile
|
name: cerFile
|
||||||
@@ -81,8 +76,8 @@ steps:
|
|||||||
action: 'create'
|
action: 'create'
|
||||||
target: '$(Build.SourceVersion)'
|
target: '$(Build.SourceVersion)'
|
||||||
tagSource: 'userSpecifiedTag'
|
tagSource: 'userSpecifiedTag'
|
||||||
tag: '$(build_date).$(rev_number)'
|
tag: '$(version)'
|
||||||
title: '$(build_date).$(rev_number)'
|
title: '$(version)'
|
||||||
releaseNotesSource: 'inline'
|
releaseNotesSource: 'inline'
|
||||||
releaseNotesInline: |
|
releaseNotesInline: |
|
||||||
## 普通用户请勿下载
|
## 普通用户请勿下载
|
||||||
@@ -102,12 +97,12 @@ steps:
|
|||||||
displayName: Upload CI via Rclone
|
displayName: Upload CI via Rclone
|
||||||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
||||||
inputs:
|
inputs:
|
||||||
arguments: 'copy $(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(build_date).$(rev_number).msix downloadDGPCN:/releases/Alpha/'
|
arguments: 'copy $(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(version).msix downloadDGPCN:/releases/Alpha/'
|
||||||
configPath: 'C:\agent\_work\_tasks\rclone.conf'
|
configPath: 'C:\agent\_work\_tasks\rclone.conf'
|
||||||
|
|
||||||
- task: rclone@1
|
- task: rclone@1
|
||||||
displayName: Upload PR CI via Rclone
|
displayName: Upload PR CI via Rclone
|
||||||
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
||||||
inputs:
|
inputs:
|
||||||
arguments: 'copy $(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(build_date).$(rev_number).msix downloadDGPCN:/releases/PR/'
|
arguments: 'copy $(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(version).msix downloadDGPCN:/releases/PR/'
|
||||||
configPath: 'C:\agent\_work\_tasks\rclone.conf'
|
configPath: 'C:\agent\_work\_tasks\rclone.conf'
|
||||||
|
|||||||
44
build.cake
44
build.cake
@@ -1,20 +1,48 @@
|
|||||||
#tool "nuget:?package=nuget.commandline&version=6.5.0"
|
#tool "nuget:?package=nuget.commandline&version=6.5.0"
|
||||||
|
#addin nuget:?package=Cake.Http&version=3.0.2
|
||||||
|
|
||||||
var target = Argument("target", "Build");
|
var target = Argument("target", "Build");
|
||||||
var configuration = Argument("configuration", "Release");
|
var configuration = Argument("configuration", "Release");
|
||||||
|
|
||||||
var version = HasArgument("Version") ? Argument<string>("Version") : throw new Exception("Empty Version");
|
var versionAuth = HasEnvironmentVariable("VERSION_API_TOKEN") ? EnvironmentVariable("VERSION_API_TOKEN") : throw new Exception("Cannot find VERSION_API_TOKEN");
|
||||||
|
var version = HttpGet(
|
||||||
|
"https://internal.snapgenshin.cn/BuildIntergration/RequestNewVersion",
|
||||||
|
new HttpSettings
|
||||||
|
{
|
||||||
|
Headers = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{ "Authorization", versionAuth }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Information($"Version: {version}");
|
||||||
|
|
||||||
var pw = HasArgument("pw") ? Argument<string>("pw") : throw new Exception("Empty pw");
|
var pw = HasArgument("pw") ? Argument<string>("pw") : throw new Exception("Empty pw");
|
||||||
|
|
||||||
// Default Azure Pipelines
|
// Pre-define
|
||||||
|
|
||||||
var repoDir = AzurePipelines.Environment.Build.SourcesDirectory.FullPath;
|
var repoDir = "repoDir";
|
||||||
var outputPath = AzurePipelines.Environment.Build.ArtifactStagingDirectory.FullPath;
|
var outputPath = "outputPath";
|
||||||
|
|
||||||
var solution = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao.sln");
|
var solution = "solution";
|
||||||
var project = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Snap.Hutao.csproj");
|
var project = "project";
|
||||||
var binPath = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "bin", "x64", "Release", "net8.0-windows10.0.22621.0", "win-x64");
|
var binPath = "binPath";
|
||||||
|
|
||||||
var pfxFile = System.IO.Path.Combine(AzurePipelines.Environment.Agent.HomeDirectory.FullPath, "_work", "_temp", "DGP_Studio_CI.pfx");
|
var pfxFile = "pfxFile";
|
||||||
|
|
||||||
|
if (AzurePipelines.IsRunningOnAzurePipelines)
|
||||||
|
{
|
||||||
|
AzurePipelines.Commands.SetVariable("version", version);
|
||||||
|
|
||||||
|
repoDir = AzurePipelines.Environment.Build.SourcesDirectory.FullPath;
|
||||||
|
outputPath = AzurePipelines.Environment.Build.ArtifactStagingDirectory.FullPath;
|
||||||
|
|
||||||
|
solution = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao.sln");
|
||||||
|
project = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Snap.Hutao.csproj");
|
||||||
|
binPath = System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "bin", "x64", "Release", "net8.0-windows10.0.22621.0", "win-x64");
|
||||||
|
|
||||||
|
pfxFile = System.IO.Path.Combine(AzurePipelines.Environment.Agent.HomeDirectory.FullPath, "_work", "_temp", "DGP_Studio_CI.pfx");
|
||||||
|
}
|
||||||
|
|
||||||
Task("Build")
|
Task("Build")
|
||||||
.IsDependentOn("Build binary package")
|
.IsDependentOn("Build binary package")
|
||||||
|
|||||||
Reference in New Issue
Block a user