forked from Revyn112/saltychat-fivem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild-Release.ps1
More file actions
129 lines (104 loc) · 4.81 KB
/
Build-Release.ps1
File metadata and controls
129 lines (104 loc) · 4.81 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# 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-FiveM.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-fivem.zip -CompressionLevel Optimal
## Salty HUD ##
# Create build directory for Salty HUD
if ((Test-Path .\release\saltyhud) -eq $false)
{
New-Item .\release\saltyhud -ItemType Directory | Out-Null
}
# Build Salty HUD Solution
$buildOutput = (& $msBuildPath saltyhud\SaltyHUD-FiveM.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 .\saltyhud\NUI -Recurse -Destination .\release\saltyhud
Copy-Item .\saltyhud\config.json -Destination .\release\saltyhud
Copy-Item .\saltyhud\Newtonsoft.Json.dll -Destination .\release\saltyhud
Copy-Item .\saltyhud\SaltyClient\bin\Release\SaltyClient.net.dll -Destination .\release\saltyhud
Copy-Item .\saltyhud\SaltyClient\bin\Release\SaltyClient.net.pdb -Destination .\release\saltyhud
# Adjust paths in fxmanifest
$shFxmanifest = Get-Content .\saltyhud\fxmanifest.lua
$shFxmanifest = $shFxmanifest -replace 'Salty(Client|Server)\/bin\/Debug\/.*Salty(Client|Server).net.(dll|pdb)', 'Salty$2.net.$3'
$shFxmanifest | Set-Content .\release\saltyhud\fxmanifest.lua
# Zip directory which will be used as release on GitHub
Compress-Archive .\release\saltyhud -DestinationPath .\release\saltyhud-fivem.zip -CompressionLevel Optimal
## Salty Talkie ##
# Create build directory for Salty HUD
if ((Test-Path .\release\saltytalkie) -eq $false)
{
New-Item .\release\saltytalkie -ItemType Directory | Out-Null
}
# Build Salty HUD Solution
$buildOutput = (& $msBuildPath saltytalkie\SaltyTalkie-FiveM.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 .\saltytalkie\NUI -Recurse -Destination .\release\saltytalkie
Copy-Item .\saltytalkie\config.json -Destination .\release\saltytalkie
Copy-Item .\saltytalkie\Newtonsoft.Json.dll -Destination .\release\saltytalkie
Copy-Item .\saltytalkie\SaltyTalkieClient\bin\Release\SaltyTalkieClient.net.dll -Destination .\release\saltytalkie
Copy-Item .\saltytalkie\SaltyTalkieClient\bin\Release\SaltyTalkieClient.net.pdb -Destination .\release\saltytalkie
# Adjust paths in fxmanifest
$shFxmanifest = Get-Content .\saltytalkie\fxmanifest.lua
$shFxmanifest = $shFxmanifest -replace 'SaltyTalkieClient\/bin\/Debug\/.*SaltyTalkieClient.net.(dll|pdb)', 'SaltyTalkieClient.net.$1'
$shFxmanifest | Set-Content .\release\saltytalkie\fxmanifest.lua
# Zip directory which will be used as release on GitHub
Compress-Archive .\release\saltytalkie -DestinationPath .\release\saltytalkie-fivem.zip -CompressionLevel Optimal