-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReleaseBuild.ps1
34 lines (26 loc) · 1.51 KB
/
ReleaseBuild.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
# Get version
$projectFilePath = "src\mGBAHttpServer\mGBAHttpServer.csproj"
$xml = [xml](Get-Content $projectFilePath)
$version = $xml.Project.PropertyGroup.Version[0]
# Enforce lua script
$luaVersionLine = (Get-Content "mGBASocketServer.lua")[2];
$luaVersion = ($luaVersionLine -split ' ')[2].Trim()
if ($luaVersion -ne $version){
throw "mGBASocketServer.lua version should be $($version). Currently is $($luaVersion)";
}
# Setup publish variables
$filenamePrefix = "mGBA-http-{0}" -f $version
$rids = @("win-x86","win-x64", "linux-x64", "osx-x64")
# Clean folder
Remove-Item .\release\* -Recurse -Force
# Create releases
foreach ($rid in $rids) {
dotnet publish src\mGBAHttpServer\mGBAHttpServer.csproj -r $rid --self-contained=false -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false -o .\releaseStaging -p:AssemblyName="$($filenamePrefix)-$($rid)"
Move-Item -Path ".\releaseStaging\*.*" -Destination ".\release" -Force
dotnet publish src\mGBAHttpServer\mGBAHttpServer.csproj -r $rid --self-contained=true -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false -o .\releaseStaging -p:AssemblyName="$($filenamePrefix)-$($rid)-self-contained" -p:TrimMode=partial -p:PublishTrimmed=false -p:IncludeAllContentForSelfExtract=true -p:JsonSerializerIsReflectionEnabledByDefault=true
Move-Item -Path ".\releaseStaging\*.*" -Destination ".\release" -Force
}
# Copy over lua script
Copy-Item -Path ".\mGBASocketServer.lua" -Destination ".\release" -Force
# Cleanup
Remove-Item .\releaseStaging -Recurse -Force