forked from IllusionMods/BepisPlugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.ps1
50 lines (40 loc) · 1.44 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
43
44
45
46
47
48
49
50
$array = @("KK", "EC", "AI", "HS", "HS2", "PH", "KKS")
if ($PSScriptRoot -match '.+?\\bin\\?') {
$dir = $PSScriptRoot + "\"
}
else {
$dir = $PSScriptRoot + "\bin\"
}
$copy = $dir + "\copy\BepInEx"
Remove-Item -Force -Path ($copy) -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path ($copy + "\plugins")
New-Item -ItemType Directory -Force -Path ($dir + "\out")
function CreateZip ($element)
{
Remove-Item -Force -Path ($copy) -Recurse
New-Item -ItemType Directory -Force -Path ($copy + "\plugins")
Copy-Item -Path ($dir + "\BepInEx\plugins\" + $element + "_BepisPlugins") -Destination ($copy + "\plugins\" + $element + "_BepisPlugins") -Recurse -Force
try
{
$ver = "r" + (Get-ChildItem -Path ($copy) -Filter ($element + "_*.dll") -Recurse -Force)[0].VersionInfo.FileVersion.ToString()
}
catch
{
$ver = "r" + (Get-ChildItem -Path ($copy) -Filter ("*.dll") -Recurse -Force)[0].VersionInfo.FileVersion.ToString()
}
& robocopy ($dir + "\BepInEx\patchers\") ($copy + "\patchers") ($element + "_*.*") /R:5 /W:5
Compress-Archive -Path $copy -Force -CompressionLevel "Optimal" -DestinationPath ($dir + "out\" + $element + "_BepisPlugins_" + $ver + ".zip")
}
foreach ($element in $array)
{
try
{
CreateZip ($element)
}
catch
{
# retry
CreateZip ($element)
}
}
Remove-Item -Force -Path ($dir + "\copy") -Recurse