-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathBuild-Release.ps1
67 lines (56 loc) · 2.2 KB
/
Build-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
# Find msbuild and use it later on
$msBuildPath = $null
if (Test-Path "C:\Program Files\Microsoft Visual Studio\2022\*\Msbuild\Current\Bin\MSBuild.exe")
{
$msBuildPath = "C:\Program Files\Microsoft Visual Studio\2022\*\Msbuild\Current\Bin\MSBuild.exe"
}
else
{
foreach($path in $env:Path.Split(";"))
{
if (Test-Path "$path\msbuild.exe")
{
$msBuildPath = "$path\msbuild.exe"
break
}
}
if ($msBuildPath -eq $null)
{
throw "Could not find msbuild"
}
}
# Cleanup/Create release directory
if (Test-Path release)
{
Remove-Item release\* -Recurse -Force
}
else
{
New-Item .\release -ItemType Directory | Out-Null
}
## Salty Chat ##
# Create build directory for Salty Chat
if ((Test-Path .\release\saltychat) -eq $false)
{
New-Item .\release\saltychat -ItemType Directory | Out-Null
}
# Build Salty Chat Solution
$buildOutput = (& $msBuildPath saltychat\SaltyChat-RedM.sln /property:Configuration=Release) -Join [System.Environment]::NewLine
if ($buildOutput -notmatch "Build succeeded.")
{
throw $buildOutput
}
# Copy all necessary items to the release directory
Copy-Item .\saltychat\NUI -Recurse -Destination .\release\saltychat
Copy-Item .\saltychat\config.json -Destination .\release\saltychat
Copy-Item .\saltychat\Newtonsoft.Json.dll -Destination .\release\saltychat
Copy-Item .\saltychat\SaltyClient\bin\Release\SaltyClient.net.dll -Destination .\release\saltychat
Copy-Item .\saltychat\SaltyClient\bin\Release\SaltyClient.net.pdb -Destination .\release\saltychat
Copy-Item .\saltychat\SaltyServer\bin\Release\netstandard2.0\SaltyServer.net.dll -Destination .\release\saltychat
Copy-Item .\saltychat\SaltyServer\bin\Release\netstandard2.0\SaltyServer.net.pdb -Destination .\release\saltychat
# Adjust paths in fxmanifest
$scFxmanifest = Get-Content .\saltychat\fxmanifest.lua
$scFxmanifest = $scFxmanifest -replace 'Salty(Client|Server)\/bin\/Debug\/.*Salty(Client|Server).net.(dll|pdb)', 'Salty$2.net.$3'
$scFxmanifest | Set-Content .\release\saltychat\fxmanifest.lua
# Zip directory which will be used as release on GitHub
Compress-Archive .\release\saltychat\* -DestinationPath .\release\saltychat-redm.zip -CompressionLevel Optimal