forked from Kagamia/WzComparerR2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
135 lines (118 loc) · 4.6 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
resources:
repositories:
- repository: CharaSimResource
type: github
name: kagamia/CharaSimResource
endpoint: Kagamia
pool:
vmImage: 'windows-latest'
variables:
solution: 'WzComparerR2/WzComparerR2.sln'
buildPlatform_anycpu: 'Any CPU'
buildPlatform_x86: 'x86'
buildConfiguration: 'Release'
outputDir_anycpu: 'WzComparerR2/WzComparerR2/bin/release'
outputDir_x86: 'WzComparerR2/WzComparerR2/bin/x86/release'
outputFileName: 'WcR2_With_Plguins_$(Build.BuildNumber)'
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
accountName: 'wcr2publish'
containerName: 'ci-build'
steps:
- checkout: self
path: s/WzComparerR2
persistCredentials: true
- checkout: CharaSimResource
- task: CmdLine@2
displayName: Generate version file
inputs:
script: |
mkdir Build
echo [assembly: global::System.Reflection.AssemblyInformationalVersion("2.1.$(Build.BuildNumber)")] >> Build\CommonAssemblyInfo.cs
workingDirectory: '$(Build.SourcesDirectory)\WzComparerR2'
- task: VSBuild@1
displayName: Build anycpu
inputs:
solution: '$(solution)'
platform: '$(buildPlatform_anycpu)'
configuration: '$(buildConfiguration)'
- task: VSBuild@1
displayName: Build x86
inputs:
solution: '$(solution)'
platform: '$(buildPlatform_x86)'
configuration: '$(buildConfiguration)'
- task: CmdLine@2
displayName: Prepare output files
inputs:
script: |
move "$(outputDir_anycpu)\*.dll" "$(outputDir_anycpu)\Lib"
del "$(outputDir_anycpu)\*.pdb"
rename "$(outputDir_anycpu)\WzComparerR2.exe" "WzComparerR2.anycpu.exe"
rename "$(outputDir_anycpu)\WzComparerR2.exe.config" "WzComparerR2.anycpu.exe.config"
copy /y "$(outputDir_x86)\WzComparerR2.exe" "$(outputDir_anycpu)"
copy /y "$(outputDir_x86)\WzComparerR2.exe.config" "$(outputDir_anycpu)"
failOnStderr: true
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(outputDir_anycpu)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(outputFileName).zip'
replaceExistingArchive: true
- task: AzureCLI@2
displayName: Upload to blob
inputs:
azureSubscription: 'Visual Studio Enterprise(66312bd9-1264-4b34-872d-2e557fc1bc0d)'
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
Write-Host "Uploading files..."
az storage blob upload --auth-mode login --account-name $(accountName) --container-name $(containerName) --name "$(outputFileName).zip" --file "$(Build.ArtifactStagingDirectory)/$(outputFileName).zip"
Write-Host "Generate url..."
$url = ConvertFrom-Json (az storage blob url --auth-mode login --account-name $(accountName) --container-name $(containerName) --name "$(outputFileName).zip")
Write-Host "Generate sas..."
$expireDate = (Get-Date).ToUniversalTime().AddYears(1).ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
$keys = ConvertFrom-Json ((az storage account keys list --account-name $(accountName)) -join "")
$accountKey = $keys[0].value
$sas = ConvertFrom-Json (az storage blob generate-sas --account-name $(accountName) --account-key "$accountKey" --container-name $(containerName) --name "$(outputFileName).zip" --expiry "$expireDate" --permissions "r")
$sasurl = "${url}?${sas}"
Write-Host "${sasurl}"
Write-Host "##vso[task.setvariable variable=sasurl]${sasurl}"
- task: GitHubRelease@1
condition: and(succeeded(), eq(variables.isMain, true))
continueOnError: true
displayName: Delete last build
inputs:
gitHubConnection: 'Kagamia'
repositoryName: '$(Build.Repository.Name)'
action: 'delete'
tag: 'ci-build'
- task: CmdLine@2
condition: and(succeeded(), eq(variables.isMain, true))
continueOnError: true
displayName: Delete ci-build tag
inputs:
script: 'git push --delete origin ci-build'
workingDirectory: '$(Build.SourcesDirectory)\WzComparerR2'
failOnStderr: false
- task: GitHubRelease@1
condition: and(succeeded(), eq(variables.isMain, true))
inputs:
gitHubConnection: 'Kagamia'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: 'ci-build'
title: 'CI-Build-$(Build.BuildNumber)'
releaseNotesSource: 'inline'
releaseNotesInline: |
Automation build from azure-pipeline.
download: [link]($(sasurl))
isPreRelease: true
addChangeLog: false