Skip to content

Commit dcec006

Browse files
committed
Add release script
1 parent 0b39442 commit dcec006

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

release.ps1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
$array = @("HC")
2+
$dir = $PSScriptRoot + "/bin/"
3+
$copy = $dir + "/copy"
4+
5+
Remove-Item -Force -Path ($dir + "/copy") -Recurse -ErrorAction SilentlyContinue
6+
Remove-Item -Force -Path ($dir + "/out") -Recurse -ErrorAction SilentlyContinue
7+
New-Item -ItemType Directory -Force -Path ($copy + "/plugins")
8+
New-Item -ItemType Directory -Force -Path ($dir + "/out")
9+
10+
foreach ($element in $array)
11+
{
12+
foreach ($filepath in [System.IO.Directory]::EnumerateFiles($dir,"*.dll","AllDirectories"))
13+
{
14+
$filename = $filepath.Replace($dir, "")
15+
16+
if ($filename.StartsWith($element))
17+
{
18+
Remove-Item -Force -Path ($copy) -Recurse
19+
New-Item -ItemType Directory -Force -Path ($copy + "/BepInEx/plugins/" + $element + "_Plugins/")
20+
21+
Copy-Item -Path ($filepath) -Destination ($copy + "/BepInEx/plugins/" + $element + "_Plugins/") -Force
22+
23+
$filepathxml = get-childitem $dir -Recurse -Force -include $filename.Replace(".dll", ".xml") -ErrorAction SilentlyContinue
24+
if ($filepathxml)
25+
{
26+
Copy-Item -Path ($filepathxml) -Destination ($copy + "/BepInEx/plugins/" + $element + "_Plugins/") -Force
27+
}
28+
29+
$version = "v" + ((Get-ChildItem -Path ($filepath) -Filter "*.dll" -Force)[0].VersionInfo.FileVersion.ToString() -replace "^([\d+\.]+?\d+)[\.0]*$", '${1}')
30+
$zipfilename = $filename.Replace(".dll", " " + $version + ".zip")
31+
32+
"Creating archive: " + $zipfilename
33+
Compress-Archive -Path ($copy + "\*") -Force -CompressionLevel "Optimal" -DestinationPath ($dir + "out/" + $zipfilename)
34+
}
35+
}
36+
}
37+
38+
Remove-Item -Force -Path ($dir + "/copy") -Recurse

0 commit comments

Comments
 (0)