mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
114 lines
3.2 KiB
YAML
114 lines
3.2 KiB
YAML
# 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:
|
|
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'
|
|
build_date: $[ format('{0:yyyy}.{0:M}.{0:d}', pipeline.startTime) ]
|
|
|
|
|
|
steps:
|
|
- task: GetRevision@1
|
|
displayName: get Pipelines revision number
|
|
inputs:
|
|
VariableName: 'rev_number'
|
|
|
|
- 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 --Version=$(build_date).$(rev_number) --pw=$(pw)
|
|
|
|
- task: DownloadSecureFile@1
|
|
name: cerFile
|
|
displayName: Download Root CA
|
|
inputs:
|
|
secureFile: 'Snap.Hutao.CI.cer'
|
|
|
|
- task: DownloadSecureFile@1
|
|
displayName: Download PFX
|
|
inputs:
|
|
secureFile: 'DGP_Studio_CI.pfx'
|
|
|
|
- task: GitHubRelease@1
|
|
inputs:
|
|
gitHubConnection: 'github.com_Masterain'
|
|
repositoryName: 'DGP-Studio/Snap.Hutao.CI.Test'
|
|
action: 'create'
|
|
target: '$(Build.SourceVersion)'
|
|
tagSource: 'userSpecifiedTag'
|
|
tag: '$(build_date).$(rev_number)'
|
|
title: '$(build_date).$(rev_number)'
|
|
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-$(build_date).$(rev_number).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-$(build_date).$(rev_number).msix downloadDGPCN:/releases/PR/'
|
|
configPath: 'C:\agent\_work\_tasks\rclone.conf'
|