-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
release.ps1
53 lines (43 loc) · 2.2 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
51
52
53
$array = @("KK", "EC", "AI", "HS", "HS2", "PH", "PC", "KKS", "SBPR")
$dir = $PSScriptRoot + "/bin/"
$copy = $dir + "/copy"
Remove-Item -Force -Path ($dir + "/copy") -Recurse -ErrorAction SilentlyContinue
Remove-Item -Force -Path ($dir + "/out") -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path ($copy + "/plugins")
New-Item -ItemType Directory -Force -Path ($dir + "/out")
foreach ($element in $array)
{
foreach ($filepath in [System.IO.Directory]::EnumerateFiles($dir,"*.dll","AllDirectories"))
{
$filename = $filepath.Replace($dir, "")
if ($filename.StartsWith($element))
{
Remove-Item -Force -Path ($copy) -Recurse
New-Item -ItemType Directory -Force -Path ($copy + "/BepInEx/plugins/" + $element + "_Plugins/")
Copy-Item -Path ($filepath) -Destination ($copy + "/BepInEx/plugins/" + $element + "_Plugins/") -Force
foreach ($modPath in [System.IO.Directory]::EnumerateFiles($dir + "..\mods\","*.zipmod","AllDirectories"))
{
$modfilename = $modPath.Replace($dir + "..\mods\", "")
if($modfilename.StartsWith($filename.Replace(".dll", "")))
{
New-Item -ItemType Directory -Force -Path ($copy + "/mods")
Copy-Item -Path ($modPath) -Destination ($copy + "/mods/") -Force
}
}
$filepathxml = get-childitem $dir -Recurse -Force -include $filename.Replace(".dll", ".xml") -ErrorAction SilentlyContinue
if ($filepathxml)
{
Copy-Item -Path ($filepathxml) -Destination ($copy + "/BepInEx/plugins/" + $element + "_Plugins/") -Force
}
if($filename.EndsWith("MaterialEditor.dll"))
{
Copy-Item -Path ($dir + "libwebp.lib") -Destination ($copy + "/BepInEx/plugins/" + $element + "_Plugins/") -Force
}
$version = "v" + (Get-ChildItem -Path ($filepath) -Filter "*.dll" -Force)[0].VersionInfo.FileVersion.ToString()
$zipfilename = $filename.Replace(".dll", " " + $version + ".zip")
"Creating archive: " + $zipfilename
Compress-Archive -Path ($copy + "\*") -Force -CompressionLevel "Optimal" -DestinationPath ($dir + "out/" + $zipfilename)
}
}
}
Remove-Item -Force -Path ($dir + "/copy") -Recurse