-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_script.ps1
35 lines (32 loc) · 955 Bytes
/
publish_script.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
function publishRuntime {
param(
$runtime
)
buildRuntime -runtime $runtime
copyRuntimeIntoAppropriateFolde $runtime
}
function buildRuntime {
param(
$runtime
)
$publishCommand = "dotnet publish ProgramExec/ -c Release -r $runtime --self-contained false -p:PublishSingleFile=true -p:DebugType=embedded -p:PublishTrimmed=false -p:PublishReadyToRun=false"
Invoke-Expression -Command $publishCommand
}
function copyRuntimeIntoAppropriateFolde {
param(
$runtime
)
$runtimePath = (Get-Item "ProgramExec\bin\Debug\net5.0\$runtime\publish\ProgramExec*").FullName
$runtimeExtension = [System.IO.Path]::GetExtension($runtimePath).ToString()
Copy-Item $runtimePath -Destination "publishToGitHub/$runtime$runtimeExtension"
}
function clearPublishToGithubFolder {
cd .\publishToGithub
rm *
cd ..
}
clearPublishToGithubFolder
$runtimes = 'win-x64', 'linux-x64', 'osx-x64'
foreach ($runtime in $runtimes) {
publishRuntime -runtime $runtime
}