Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1eda938

Browse files
committedMay 20, 2020
powershell script to automate build release packages
1 parent a2512aa commit 1eda938

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
 

‎publish.ps1‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# build release packages
2+
3+
4+
Function Build($dir, $arch)
5+
{
6+
# clean dir
7+
if (Test-Path $dir)
8+
{
9+
Remove-Item $dir -Recurse -Force
10+
}
11+
dotnet publish -c Release /p:PublishSingleFile=true --runtime $arch --framework $framework WebAPI
12+
}
13+
14+
Function Pack($dir, $arch)
15+
{
16+
17+
mkdir -p $dir\CharacterEditor\Resources
18+
# copy resources
19+
xcopy /y /s /e CharacterEditor\Resources $dir\CharacterEditor\Resources
20+
# create zip archive in the root
21+
& $zip_exe a -mpass=10 "api.pvpgn.pro_${version}_$arch.zip" .\$dir\*
22+
}
23+
24+
25+
$version = Select-String -Path .\WebAPI\WebAPI.csproj -Pattern '<Version>(.*)</Version>' -AllMatches | %{ $_.Matches.Groups[1] } | %{ $_.Value }
26+
27+
$framework = "netcoreapp3.1"
28+
$rdir = "WebAPI\bin\Release\$framework"
29+
$zip_exe = "C:\Program Files\7-Zip\7z.exe"
30+
31+
32+
echo "Framework: $framework"
33+
echo "App Version: $version"
34+
echo " "
35+
36+
# build for every architecture
37+
$arch = "win-x64"
38+
$publish = "$rdir\$arch\publish"
39+
Build $publish $arch
40+
Pack $publish $arch
41+
42+
$arch = "linux-x64"
43+
$publish = "$rdir\$arch\publish"
44+
Build $publish $arch
45+
Pack $publish $arch
46+
47+
$arch = "osx-x64"
48+
$publish = "$rdir\$arch\publish"
49+
Build $publish $arch
50+
Pack $publish $arch
51+

0 commit comments

Comments
 (0)
Please sign in to comment.