-
Notifications
You must be signed in to change notification settings - Fork 33
/
release.ps1
42 lines (33 loc) · 1.1 KB
/
release.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
$array = @("KK_OverlayMods", "KKS_OverlayMods", "EC_OverlayMods", "AI_OverlayMods", "HS2_OverlayMods")
if ($PSScriptRoot -match '.+?\\bin\\?') {
$dir = $PSScriptRoot + "\"
}
else {
$dir = $PSScriptRoot + "\bin\"
}
$out = $dir + "BepInEx\plugins\"
New-Item -ItemType Directory -Force -Path $out
New-Item -ItemType Directory -Force -Path ($dir + "out\")
function CreateZip ($element)
{
Remove-Item -Force -Path ($out + "*")
New-Item -ItemType Directory -Force -Path $out
Copy-Item -Path ($dir + $element + ".dll") -Destination $out
Copy-Item -Path ($dir + $element + ".xml") -Destination $out
$ver = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dir + $element + ".dll").FileVersion.ToString()
Compress-Archive -Path ($dir + "BepInEx") -Force -CompressionLevel "Optimal" -DestinationPath ($dir + "out\" + $element + "_" + $ver + ".zip")
}
foreach ($element in $array)
{
try
{
CreateZip ($element)
}
catch
{
# retry
CreateZip ($element)
}
}
Remove-Item -Force -Path ($out + "*")
Remove-Item -Force -Path ($dir + "BepInEx") -Recurse