-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-artifacts.ps1
71 lines (50 loc) · 1.42 KB
/
copy-artifacts.ps1
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
<#
.SYNOPSIS
Extract the build artifacts for installation or upload
.PARAMETER Configuration
The current build configuration (Debug or Release)
.PARAMETER Out
Directory to copy the artifacts to
.PARAMETER BuildNumber
The 'd' in 'a.b.c.d'
.EXAMPLE
./copy-artifacts -Configuration Debug
.EXAMPLE
./copy-artifacts -Configuration Debug -Out ../out/
#>
[cmdletbinding()]
param(
[ValidateSet('Debug', 'Release')]
[string] $Configuration='Debug',
[string] $Out="$(Get-Location)/out",
[string] $Platform="x64",
[int] $BuildNumber=0
)
If (!(Test-Path $Out)) {
New-Item -ItemType Directory -Path $Out
}
$pluginVersion = "1.0.2.${BuildNumber}"
Set-Content $Out/version.txt -Value $pluginVersion
$metadataJson = "${Out}/metadata.json"
(Get-Content -Path OTDIPC/metadata.in.json) `
-Replace "@PLUGIN_VERSION@","${pluginVersion}" `
| Set-Content -Path $metadataJson
$compress = @{
Path = @(
"OTDIPC/bin/${Configuration}/net6.0/OpenKneeboard-OTDIPC.dll",
$metadataJson
)
DestinationPath = "${Out}\OpenKneeboard-OTD-IPC.zip"
Force = $True
}
Compress-Archive @compress
Remove-Item $metadataJson
Copy-Item OTDIPC/bin/$Configuration/net6.0/*.pdb $Out
Copy-Item $Platform/$Configuration/*.pdb $Out
Copy-Item $Platform/$Configuration/*.exe $Out
$compress = @{
Path = (Get-ChildItem -Path $Out -Filter '*.pdb')
DestinationPath = "${Out}/DebugSymbols.zip"
Force = $True
}
Compress-Archive @compress