@@ -5,12 +5,12 @@ $windowsTfmSuffix = '-windows'
55
66function Clean-Output
77{
8- if (Test-Path ./ artifacts) { rm ./ artifacts - Force - Recurse }
8+ if (Test-Path ./ artifacts) { rm ./ artifacts - Force - Recurse }
99}
1010
1111function Restore-Packages
1212{
13- & dotnet restore
13+ & dotnet restore
1414 if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
1515}
1616
@@ -22,46 +22,46 @@ function Execute-Tests
2222
2323function Create-ArtifactDir
2424{
25- mkdir ./ artifacts
25+ mkdir ./ artifacts
2626}
2727
2828function Publish-Archives ($version )
2929{
30- $rids = @ ( " linux-x64 " , " linux-musl-x64 " , " linux-arm64 " , " osx-x64 " , " win-x64 " )
31- foreach ($rid in $rids ) {
32- $tfm = $framework
33- if ($rid -eq " win-x64" ) {
34- $tfm = " $tfm$windowsTfmSuffix "
35- }
36-
37- & dotnet publish ./ src/ SeqCli/ SeqCli.csproj - c Release -f $tfm - r $rid / p:VersionPrefix= $version
38- if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
39-
40- # Make sure the archive contains a reasonable root filename
41- mv ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / publish/ ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid /
42-
43- if ($rid.StartsWith (" win-" )) {
44- & ./ build/ 7 - zip/ 7za.exe a - tzip ./ artifacts/ seqcli- $version - $rid.zip ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid /
45- if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
46- } else {
47- & ./ build/ 7 - zip/ 7za.exe a - ttar seqcli- $version - $rid.tar ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid /
48- if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
49-
50- # Back to the original directory name
51- mv ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid / ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / publish/
52-
53- & ./ build/ 7 - zip/ 7za.exe a - tgzip ./ artifacts/ seqcli- $version - $rid.tar.gz seqcli- $version - $rid.tar
54- if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
55-
56- rm seqcli- $version - $rid.tar
57- }
58- }
30+ $rids = $ ([ xml ]( Get-Content .\src\SeqCli\SeqCli.csproj)).Project.PropertyGroup.RuntimeIdentifiers.Split( ' ; ' )
31+ foreach ($rid in $rids ) {
32+ $tfm = $framework
33+ if ($rid -eq " win-x64" ) {
34+ $tfm = " $tfm$windowsTfmSuffix "
35+ }
36+
37+ & dotnet publish ./ src/ SeqCli/ SeqCli.csproj - c Release -f $tfm - r $rid -- self - contained / p:VersionPrefix= $version
38+ if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
39+
40+ # Make sure the archive contains a reasonable root filename
41+ mv ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / publish/ ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid /
42+
43+ if ($rid.StartsWith (" win-" )) {
44+ & ./ build/ 7 - zip/ 7za.exe a - tzip ./ artifacts/ seqcli- $version - $rid.zip ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid /
45+ if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
46+ } else {
47+ & ./ build/ 7 - zip/ 7za.exe a - ttar seqcli- $version - $rid.tar ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid /
48+ if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
49+
50+ # Back to the original directory name
51+ mv ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / seqcli- $version - $rid / ./ src/ SeqCli/ bin/ Release/ $tfm / $rid / publish/
52+
53+ & ./ build/ 7 - zip/ 7za.exe a - tgzip ./ artifacts/ seqcli- $version - $rid.tar.gz seqcli- $version - $rid.tar
54+ if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
55+
56+ rm seqcli- $version - $rid.tar
57+ }
58+ }
5959}
6060
6161function Publish-DotNetTool ($version )
62- {
63- # Tool packages have to target a single non-platform-specific TFM; doing this here is cleaner than attempting it in the CSPROJ directly
64- dotnet pack ./ src/ SeqCli/ SeqCli.csproj - c Release -- output ./ artifacts / p:VersionPrefix= $version / p:TargetFrameworks= $framework
62+ {
63+ # Tool packages have to target a single non-platform-specific TFM; doing this here is cleaner than attempting it in the CSPROJ directly
64+ dotnet pack ./ src/ SeqCli/ SeqCli.csproj - c Release -- output ./ artifacts / p:VersionPrefix= $version / p:TargetFrameworks= $framework
6565 if ($LASTEXITCODE -ne 0 ) { throw " Build failed" }
6666}
6767
0 commit comments