forked from christianspecht/scm-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release.ps1
67 lines (48 loc) · 1.38 KB
/
build-release.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Write-Host '###### INITIALIZE ######'
if ($env:APPVEYOR) {
# We are on AppVeyor
# - environment variables are set in the AppVeyor settings
# - version-number.ps1 was already called before AssemblyInfo patching
}
else {
if (Test-Path -Path 'release') {
Remove-Item -Recurse -Force 'release'
}
if (Test-Path -Path $PSScriptRoot\environment-variables.ps1) {
& $PSScriptRoot\environment-variables.ps1
}
else {
Write-Host 'environment-variables.ps1 is missing. Build will be canceled!'
exit
}
& $PSScriptRoot\version-number.ps1
}
$release_filename = 'scm-backup-' + $env:ScmBackupLongVersion
dotnet restore
''
Write-Host '###### BUILD SOLUTION ######'
dotnet build -c Release
if ($LASTEXITCODE -eq 1) {
throw
}
''
Write-Host '###### UNIT TESTS ######'
dotnet test "$PSScriptRoot\src\ScmBackup.Tests\ScmBackup.Tests.csproj" -c Release
if ($LASTEXITCODE -eq 1) {
throw
}
''
Write-Host '###### INTEGRATION TESTS ######'
dotnet test "$PSScriptRoot\src\ScmBackup.Tests.Integration\ScmBackup.Tests.Integration.csproj" -c Release
if ($LASTEXITCODE -eq 1) {
throw
}
''
Write-Host '###### PUBLISH ######'
dotnet publish "$PSScriptRoot\src\ScmBackup" -c Release -o "$PSScriptRoot\release\bin"
if ($LASTEXITCODE -eq 1) {
throw
}
''
Write-Host '###### ZIP ######'
7z a -r "release\$release_filename.zip" .\release\bin\*