forked from HeroesToolChest/heroes-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
170 lines (148 loc) · 6.03 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
variables:
source_folder: heroesdata/
latest_release_files: ./latest_release
partial_files: ./partial_files
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: Validate
steps:
- pwsh: |
$result = ./ps1/encoding-check.ps1 -Path $env:SOURCE_FOLDER
if ($result -eq 1)
{
exit 1
}
$result = ./ps1/file-verification.ps1 -Path $env:SOURCE_FOLDER
if ($result -eq 1)
{
exit 1
}
displayName: Validate files
- job: GetFiles
dependsOn: Validate
condition: and(succeeded('Validate'), ne(variables['build.Reason'], 'PullRequest'))
steps:
- task: DownloadGitHubRelease@0
displayName: Download Latest Release
inputs:
connection: 'koliva8245-OAuth'
userRepository: 'HeroesToolChest/heroes-data'
defaultVersionType: 'latest'
itemPattern: 'heroes-data-*_all.zip'
downloadPath: '$(System.ArtifactsDirectory)'
- task: ExtractFiles@1
displayName: Extract Latest Release
inputs:
archiveFilePatterns: '$(System.ArtifactsDirectory)/heroes-data-*_all.zip'
destinationFolder: '$(latest_release_files)'
cleanDestinationFolder: true
- pwsh: |
$versions = Get-ChildItem -Path $env:SOURCE_FOLDER -Directory -Name
$last_version = $versions[-1]
$last_version
Write-Host "##vso[task.setvariable variable=version]$last_version"
displayName: Get Lastest Version
- pwsh: |
Write-Host "Old path directories:"
Get-ChildItem -Path $env:LATEST_RELEASE_FILES -Directory -Name
Write-Host "New path directories:"
Get-ChildItem -Path $env:SOURCE_FOLDER -Directory -Name
if (Write-Host (Get-ChildItem $env:LATEST_RELEASE_FILES | Measure-Object).Count -eq 0)
{
Write-Host "##vso[task.LogIssue type=error;]No files in old path"
exit 1
}
./ps1/get-diff-files.ps1 -OldPath $env:LATEST_RELEASE_FILES -NewPath $env:SOURCE_FOLDER -PartialPath $env:PARTIAL_FILES
$exists = Test-Path $env:PARTIAL_FILES -PathType Container
Write-Host "##vso[task.setvariable variable=partialExists]$exists"
Write-Host $exists
displayName: Get New Files
- task: ArchiveFiles@2
displayName: Archive Files - All - Zip
inputs:
rootFolderOrFile: '$(source_folder)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_all.zip'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Archive Files - All - Tar
inputs:
rootFolderOrFile: '$(source_folder)'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_all.tar.gz'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Archive Files - Last - Zip
inputs:
rootFolderOrFile: '$(source_folder)/$(version)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_last.zip'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Archive Files - Last - Tar
inputs:
rootFolderOrFile: '$(source_folder)/$(version)'
includeRootFolder: true
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_last.tar.gz'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Archive Files - New - Zip
inputs:
rootFolderOrFile: '$(partial_files)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_new.zip'
replaceExistingArchive: true
condition: and(succeeded(), eq(variables['partialExists'], 'True'))
- task: ArchiveFiles@2
displayName: Archive Files - New - Tar
inputs:
rootFolderOrFile: '$(partial_files)'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_new.tar.gz'
replaceExistingArchive: true
condition: and(succeeded(), eq(variables['partialExists'], 'True'))
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - All - Zip
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_all.zip'
ArtifactName: 'heroes-data-$(version)_all'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - All - Tar
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_all.tar.gz'
ArtifactName: 'heroes-data-$(version)_all'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - Last - Zip
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_last.zip'
ArtifactName: 'heroes-data-$(version)_last'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - Last - Tar
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_last.tar.gz'
ArtifactName: 'heroes-data-$(version)_last'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - New - Zip
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_new.zip'
ArtifactName: 'heroes-data-$(version)_new'
publishLocation: 'Container'
condition: and(succeeded(), eq(variables['partialExists'], 'True'))
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - New - Tar
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/heroes-data-$(version)_new.tar.gz'
ArtifactName: 'heroes-data-$(version)_new'
publishLocation: 'Container'
condition: and(succeeded(), eq(variables['partialExists'], 'True'))