Skip to content

Commit

Permalink
powershell script to automate build release packages
Browse files Browse the repository at this point in the history
  • Loading branch information
HarpyWar committed May 20, 2020
1 parent a2512aa commit 1eda938
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions publish.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# build release packages


Function Build($dir, $arch)
{
# clean dir
if (Test-Path $dir)
{
Remove-Item $dir -Recurse -Force
}
dotnet publish -c Release /p:PublishSingleFile=true --runtime $arch --framework $framework WebAPI
}

Function Pack($dir, $arch)
{

mkdir -p $dir\CharacterEditor\Resources
# copy resources
xcopy /y /s /e CharacterEditor\Resources $dir\CharacterEditor\Resources
# create zip archive in the root
& $zip_exe a -mpass=10 "api.pvpgn.pro_${version}_$arch.zip" .\$dir\*
}


$version = Select-String -Path .\WebAPI\WebAPI.csproj -Pattern '<Version>(.*)</Version>' -AllMatches | %{ $_.Matches.Groups[1] } | %{ $_.Value }

$framework = "netcoreapp3.1"
$rdir = "WebAPI\bin\Release\$framework"
$zip_exe = "C:\Program Files\7-Zip\7z.exe"


echo "Framework: $framework"
echo "App Version: $version"
echo " "

# build for every architecture
$arch = "win-x64"
$publish = "$rdir\$arch\publish"
Build $publish $arch
Pack $publish $arch

$arch = "linux-x64"
$publish = "$rdir\$arch\publish"
Build $publish $arch
Pack $publish $arch

$arch = "osx-x64"
$publish = "$rdir\$arch\publish"
Build $publish $arch
Pack $publish $arch

0 comments on commit 1eda938

Please sign in to comment.