-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathpublish_2.ps1
68 lines (55 loc) · 1.9 KB
/
publish_2.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
$version = Get-Content "SakuraLibrary\Consts.cs" | Select-String "Version = `"(.+)`";"
$version = $version.Matches[0].Groups[1].Value
$projects = "SakuraLibrary", "SakuraLauncher", "LegacyLauncher", "SakuraFrpService"
function Sign {
param (
$File
)
openssl dgst -sign $env:SAKURA_SIGN_KEY -sha256 -out "$File.sig" $File
}
function PackLauncher {
param (
$Variation,
[String[]]$Files
)
New-Item -Name "launcher" -ItemType "directory" -ErrorAction SilentlyContinue
Copy-Item -Recurse "SakuraLibrary\*" "launcher"
Copy-Item -Recurse "SakuraFrpService\*" "launcher"
Copy-Item -Recurse "$Variation\*" "launcher"
$target = $Variation -replace "Launcher", "Update"
Compress-Archive -Force -CompressionLevel Optimal -Path "launcher\*" -DestinationPath "$target.zip"
Remove-Item "launcher" -Recurse
}
function PackFrpc {
param (
$Architecture
)
New-Item -Name "frpc" -ItemType "directory" -ErrorAction SilentlyContinue
Copy-Item "sign\frpc_windows_${Architecture}_gui.exe" "frpc\frpc.exe"
Copy-Item "sign\frpc_windows_${Architecture}_gui.exe.sig" "frpc\frpc.exe.sig"
Compress-Archive -Force -CompressionLevel Optimal -Path "frpc\*" -DestinationPath "frpc_windows_$Architecture.zip"
Remove-Item "frpc" -Recurse
}
try {
Push-Location -Path "_publish"
foreach ($i in Get-ChildItem -Path "sign") {
if ($projects -contains $i.BaseName) {
Move-Item -Path $i.FullName -Destination $i.BaseName
Sign "$($i.BaseName)\$($i.Name)"
}
if ($i -match "^frpc_.+_gui\.exe$") {
Sign $i.FullName
}
}
ISCC "..\setup.iss"
# Create launcher update package
PackLauncher "SakuraLauncher"
PackLauncher "LegacyLauncher"
# Create frpc update package
PackFrpc "386"
PackFrpc "amd64"
PackFrpc "arm64"
}
finally {
Pop-Location
}