-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.ps1
72 lines (47 loc) · 1.53 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
$topdir = $PSScriptRoot
if ($topdir -eq "") {
$topdir = "."
}
function Zip-Plugin {
param([string]$plugin_name)
$plugin_dir = $topdir + "\bin"
$dlls = (Get-ChildItem -Path ($plugin_dir) -Filter ($plugin_name + ".dll") -Recurse -Force)
if (!$dlls) {
#echo "$plugin_dir : no dlls"
return
}
$dll = $dlls[0]
$version = $dll.VersionInfo.FileVersion.ToString()
if (!$version) {
# echo "$plugin_dir : no version"
return
}
$srcpath = "src\" + $dll.BaseName
if (-Not (Test-Path $srcpath)) {
return
}
if ($version -eq "0.0.0.0") {
return
}
$workdir = $topdir + "\work"
$destdir = $workdir + "\BepInEx\plugins\TranslationTools"
$zipfile = $topdir + "\dist\" + $dll.BaseName + ".v" + $version + ".zip"
if (Test-Path $zipfile) {
return
}
if (Test-Path $workdir) {
Remove-Item -Force -Path $workdir -Recurse
}
$dummy = New-Item -ItemType Directory -Force -Path $destdir
Copy-Item -Path $dll.FullName -Destination $destdir -Recurse -Force
$dummy = New-Item -ItemType Directory -Force -Path ($topdir + "\dist")
pushd $workdir
Compress-Archive -Path "BepInEx" -Force -CompressionLevel "Optimal" -DestinationPath $zipfile
popd
echo $zipfile
Remove-Item -Force -Path $workdir -Recurse
}
$plugin_files = Get-ChildItem -Path ($topdir + "\bin") -Filter "*.dll" -Depth 1 -Recurse -File
foreach ($plugin in $plugin_files) {
Zip-Plugin $plugin.BaseName
}