-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.ps1
executable file
·48 lines (40 loc) · 1.42 KB
/
publish.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
$ErrorActionPreference = 'Stop'
$release = "v1.0.0"
$platforms = @('Windows', 'Linux', 'MacOS')
$rids = @{
'Windows' = 'win-x64';
'Linux' = 'linux-x64';
'MacOS' = 'osx-x64';
}
$dirSeparator = [IO.Path]::DirectorySeparatorChar
$publishDir = "AliTheAndroid" + $dirSeparator + "publish"
foreach ($platform in $platforms)
{
$zipFile = "AliTheAndroid-$platform-$release.zip"
if (Test-Path($publishDir))
{
Remove-Item $publishDir -Recurse
}
# Source: https://stackoverflow.com/questions/44074121/build-net-core-console-application-to-output-an-exe
# Publish to an exe + dependencies. 40MB baseline.
dotnet publish -c Release -r $rids[$platform] -o publish
$command = ("chmod a+x $publishDir" + $dirSeparator + 'AliTheAndroid')
if ($platform -eq 'Windows')
{
$command += ".exe"
}
Invoke-Expression $command
# Copy all content over since we're not using the MonoGame content pipeline
foreach ($folder in @('Content', 'Fonts'))
{
Copy-Item -Recurse ("AliTheAndroid" + $dirSeparator + $folder) ($publishDir + $dirSeparator + $folder)
}
# Zip it up. ~17MB baseline.
if (Test-Path($zipFile))
{
Remove-Item $zipFile
}
Add-Type -A 'System.IO.Compression.FileSystem'
[IO.Compression.ZipFile]::CreateFromDirectory($publishDir, $zipFile);
Write-Host DONE! Zipped to $zipFile
}