-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powershell script to automate build release packages
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|