-
Notifications
You must be signed in to change notification settings - Fork 12
/
create-artifacts-matrix.js
57 lines (49 loc) · 1.43 KB
/
create-artifacts-matrix.js
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
module.exports = (artifactsString, architecture) => {
const artifacts = artifactsString.split(' ')
if (artifacts.length < 1) {
throw new Error('No artifacts provided. Provide in a space-separated string, e.g. "installer portable"')
}
const validArtifacts = [
{
name: 'installer',
filePrefix: 'Git',
fileExtension: 'exe'
},
{
name: 'portable',
filePrefix: 'PortableGit',
fileExtension: 'exe'
},
{
name: 'archive',
filePrefix: 'Git',
fileExtension: 'tar.bz2'
},
{
name: 'mingit',
filePrefix: 'MinGit',
fileExtension: 'zip'
}
]
if (architecture !== 'aarch64') validArtifacts.push({
name: 'mingit-busybox',
filePrefix: 'MinGit',
fileExtension: 'zip'
})
if (architecture === 'x86_64') validArtifacts.push({
name: 'nuget',
filePrefix: 'Git',
fileExtension: 'nupkg'
})
const artifactsToBuild = []
for (const artifact of artifacts) {
const artifactObject = validArtifacts.find(a => a.name === artifact)
if (!artifactObject) {
throw new Error(`${artifact} is not a valid artifact for ${architecture}`)
}
artifactsToBuild.push(artifactObject)
}
return {
artifact: artifactsToBuild
}
}