-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
55 lines (43 loc) · 1.38 KB
/
build.ps1
File metadata and controls
55 lines (43 loc) · 1.38 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Build
#
[CmdletBinding()]
Param (
[Switch]
$Publish
)
# Settings
#
$AppName = "NZ.RdpMaid.App"
$UpdaterAppName = "NZ.RdpMaid.Updater"
$SolutionPath = "./src/NZ.RdpMaid.sln"
$ProjectPath = "./src/NZ.RdpMaid.App/NZ.RdpMaid.App.csproj"
$PublishPath = "./publish"
$PublishCurrentPath = "$PublishPath/current"
# Run
#
if ($Publish)
{
# Detect Version
$Version = (Select-Xml -Path $ProjectPath -XPath '/Project/PropertyGroup/Version').Node.InnerXml
if (-not $Version)
{
throw 'В файле проекта отсутствует тег <Version>'
}
$PackageName = "$($AppName)-v$($Version).zip"
Write-Host "Version = $Version"
Write-Host "[Build]"
dotnet build $SolutionPath
Write-Host "[Prepare publish directory]"
if (Test-Path -Path $PublishCurrentPath)
{
Remove-Item $PublishCurrentPath -Recurse -Force
}
Write-Host "[Copy publish files]"
Copy-Item "./src/$AppName/bin/Debug" $PublishCurrentPath -Recurse
Copy-Item "./src/$UpdaterAppName/bin/Debug/net8.0-windows/*" "$PublishCurrentPath/net8.0-windows7.0/__updater" -Recurse
Copy-Item "./README.md" $PublishCurrentPath
Copy-Item "./CHANGELOG.md" $PublishCurrentPath
Copy-Item "./doc/*.*" $PublishCurrentPath
Write-Host "[Create package]"
Compress-Archive -Path "$PublishCurrentPath/*" -DestinationPath "$PublishPath/$PackageName" -Force
}