forked from IllusionMods/BepisPlugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.ps1
41 lines (32 loc) · 1.14 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
$array = @("KK", "EC", "AI", "HS", "HS2", "PH")
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
$ver = "r" + (Get-ChildItem -Path ($copy) -Filter "*.dll" -Recurse -Force)[0].VersionInfo.FileVersion.ToString()
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