-
-
Notifications
You must be signed in to change notification settings - Fork 340
/
build-legacy.ps1
60 lines (48 loc) · 1.45 KB
/
build-legacy.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
param(
[string] $ReleasePath = ".\release",
[string] $VersionPrefix = "5.0.0",
[string] $VersionSuffix = $null
)
$publishPath = "publish\legacy"
$platforms = $(
## linux builds ##
# "linux-arm64",
# "linux-musl-x64",
# "linux-x64",
# "linux-musl-arm64",
## windows ##
"win-x64"
#"win-arm64",
## mac ##
# "osx-x64",
# "osx-arm64"
)
if (Test-Path -Path ".\$publishPath") { Remove-Item -Path ".\$publishPath" -Force -Recurse }
$platforms | ForEach-Object {
$buildArgs = @(
"publish"
"-c"
"Release"
"-r"
$_
"--self-contained"
"true"
"-p:PublishSingleFile=true"
"-o"
".\$publishPath\$_"
"/p:VersionPrefix=""$VersionPrefix"""
)
if (![String]::IsNullOrWhitespace($VersionSuffix)) {
$buildArgs += "--version-suffix"
$buildArgs += """$VersionSuffix"""
}
$buildArgs += ".\src\TEdit\TEdit.csproj"
& dotnet $buildArgs
if (Test-Path -Path ".\schematics") { Copy-Item -Path ".\schematics" -Destination ".\$publishPath\$_\" -Recurse }
# Create ZIP Release
$filename = ".\$ReleasePath\TEdit-$VersionPrefix.zip"
if (![String]::IsNullOrWhitespace($VersionSuffix)) {
$filename = ".\$ReleasePath\TEdit-$VersionPrefix-$VersionSuffix.zip"
}
Compress-Archive -Path ".\$publishPath\$_\*" -DestinationPath $filename
}