From 402d491aff4761177ccf1bbd704d2a540c8f9aa7 Mon Sep 17 00:00:00 2001 From: qhy040404 <45379733+qhy040404@users.noreply.github.com> Date: Sun, 4 Feb 2024 10:58:23 +0800 Subject: [PATCH] say goodbye to azp --- azure-pipelines.yml | 119 -------------------------------------------- build.cake | 26 ++-------- 2 files changed, 3 insertions(+), 142 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index ca0b5b85..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,119 +0,0 @@ -# CI process script for Snap.Hutao -# Usage: -# 1. Append the script in Pipelines -# 2. Upload the pfx and cer certificates to Pipelines Library secrets -# 3. Permit the pfx usage -# 4. Add a `pw` variable in the script variables, which is pfx password -# 5. Connect the GitHub in project settings -# 6. Run - -trigger: none -pr: none -# trigger: -# branches: -# include: -# - main -# - develop -# paths: -# exclude: -# - README.md -# - azure-pipelines.yml -# - .github/ISSUE_TEMPLATE/*.yml -# - .github/workflows/*.yml -# - src/Snap.Hutao/Snap.Hutao/Resource/Localization/*.resx -# pr: -# branches: -# include: -# - main -# paths: -# exclude: -# - README.md -# - azure-pipelines.yml -# - .github/ISSUE_TEMPLATE/*.yml -# - .github/workflows/*.yml -# - src/Snap.Hutao/Snap.Hutao/Resource/Localization/*.resx - - -pool: - name: Default - demands: agent.name -equals Hutao-Server - -variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - solution: '$(Build.SourcesDirectory)/src/Snap.Hutao/Snap.Hutao.sln' - project: $(Build.SourcesDirectory)/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj' - buildPlatform: 'x64' - buildConfiguration: 'Release' - - -steps: -- task: UseDotNet@2 - displayName: Install dotNet - inputs: - packageType: 'sdk' - version: '8.x' - includePreviewVersions: true - -- task: CmdLine@2 - displayName: dotnet cake - inputs: - script: dotnet tool restore && dotnet cake - -- task: MsixSigning@1 - name: signMsix - displayName: Sign MSIX package - inputs: - package: '$(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(version).msix' - certificate: 'DGP_Studio_CI.pfx' - passwordVariable: 'pw' - condition: succeeded() - -- task: DownloadSecureFile@1 - name: cerFile - displayName: Download Root CA - inputs: - secureFile: 'Snap.Hutao.CI.cer' - -- task: PublishPipelineArtifact@1 - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' - artifact: 'Snap.Hutao.Alpha-$(version).msix' - publishLocation: 'pipeline' - -#- task: GitHubRelease@1 -# inputs: -# gitHubConnection: 'github.com_Masterain' -# repositoryName: 'DGP-Automation/Hutao-Auto-Release' -# action: 'create' -# target: '$(Build.SourceVersion)' -# tagSource: 'userSpecifiedTag' -# tag: '$(version)' -# title: '$(version)' -# releaseNotesSource: 'inline' -# releaseNotesInline: | -# ## 普通用户请勿下载 -# 该版本是由 CI 程序自动打包生成的 `Alpha` 测试版本,**仅供开发者测试使用** -# -# 普通用户请[点击这里](https://github.com/DGP-Studio/Snap.Hutao/releases/latest/)下载最新的稳定版本 -# -# assets: | -# $(Build.ArtifactStagingDirectory)/* -# $(cerFile.secureFilePath) -# isPreRelease: true -# changeLogCompareToRelease: 'lastFullRelease' -# changeLogType: 'commitBased' - - -- task: rclone@1 - displayName: Upload CI via Rclone - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - inputs: - arguments: 'copy $(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(version).msix downloadDGPCN:/releases/Alpha/' - configPath: 'C:\agent\_work\_tasks\rclone.conf' - -- task: rclone@1 - displayName: Upload PR CI via Rclone - condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) - inputs: - arguments: 'copy $(Build.ArtifactStagingDirectory)/Snap.Hutao.Alpha-$(version).msix downloadDGPCN:/releases/PR/' - configPath: 'C:\agent\_work\_tasks\rclone.conf' diff --git a/build.cake b/build.cake index 2d174f35..d99f0191 100644 --- a/build.cake +++ b/build.cake @@ -28,27 +28,7 @@ string manifest get => System.IO.Path.Combine(repoDir, "src", "Snap.Hutao", "Snap.Hutao", "Package.appxmanifest"); } -if (AzurePipelines.IsRunningOnAzurePipelines) -{ - repoDir = AzurePipelines.Environment.Build.SourcesDirectory.FullPath; - outputPath = AzurePipelines.Environment.Build.ArtifactStagingDirectory.FullPath; - - var versionAuth = HasEnvironmentVariable("VERSION_API_TOKEN") ? EnvironmentVariable("VERSION_API_TOKEN") : throw new Exception("Cannot find VERSION_API_TOKEN"); - version = HttpGet( - "https://internal.snapgenshin.cn/BuildIntergration/RequestNewVersion", - new HttpSettings - { - Headers = new Dictionary - { - { "Authorization", versionAuth } - } - } - ); - Information($"Version: {version}"); - - AzurePipelines.Commands.SetVariable("version", version); -} -else if (GitHubActions.IsRunningOnGitHubActions) +if (GitHubActions.IsRunningOnGitHubActions) { repoDir = GitHubActions.Environment.Workflow.Workspace.FullPath; outputPath = System.IO.Path.Combine(repoDir, "src", "output"); @@ -106,7 +86,7 @@ Task("Generate AppxManifest") var content = System.IO.File.ReadAllText(manifest); - if (AzurePipelines.IsRunningOnAzurePipelines || GitHubActions.IsRunningOnGitHubActions) + if (GitHubActions.IsRunningOnGitHubActions) { Information("Using CI configuraion"); content = content @@ -175,7 +155,7 @@ Task("Build MSIX") .Does(() => { var arguments = "arguments"; - if (AzurePipelines.IsRunningOnAzurePipelines || GitHubActions.IsRunningOnGitHubActions) + if (GitHubActions.IsRunningOnGitHubActions) { arguments = "pack /d " + binPath + " /p " + System.IO.Path.Combine(outputPath, $"Snap.Hutao.Alpha-{version}.msix"); }