-
Notifications
You must be signed in to change notification settings - Fork 29
/
PrepareRelease.ps1
89 lines (71 loc) · 3.51 KB
/
PrepareRelease.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Function Build()
{
$msbuild=$env:MSBUILD
$solutionPath = Join-Path $solutionDir 'Winium.sln'
&$msbuild ($solutionPath, '/v:minimal', '/p:configuration=Release', '/t:Clean,Build')
if (!$?) {
Write-Host "Build failed. $?" -ForegroundColor Red
Exit 1
}
}
Function Test()
{
Write-Host "Running tests"
$runTestsPath = Join-Path $solutionDir 'TestApp.Test\py-functional'
$env:RELEASE=1
$env:REMOTE_RUN=1
$proc = Start-Process "$runTestsPath/run_tests.bat" -PassThru -Wait -WorkingDirectory $runTestsPath
Write-Host $proc.ExitCode
if (!$proc.ExitCode.Equals(0))
{
Write-Host "Tests failed. See junit-result-*.xml" -ForegroundColor Red
Exit 2
}
}
Function Clean()
{
Remove-Item $releaseDir -Force -Recurse
New-Item -ItemType directory -Path $releaseDir
}
Function PackNuGet ()
{
Write-Host "Packing Nuget package"
Get-ChildItem -Path $releaseDir -Filter "*.nupkg" | foreach ($_) { Remove-Item $_.FullName }
$nuget = Join-Path $solutionDir '.nuget\nuget.exe'
$storeappsInnerServerProjectDir = Join-Path $solutionDir 'Winium.StoreApps.InnerServer'
$storeappsInnerServerProjectPath = Join-Path $storeappsInnerServerProjectDir 'Winium.StoreApps.InnerServer.csproj'
&$nuget ('pack', $storeappsInnerServerProjectPath, '-IncludeReferencedProjects', '-Properties', 'Configuration=Release', '-OutputDirectory', $releaseDir)
$silverlightInnerServerProjectDir = Join-Path $solutionDir 'Winium.Silverlight.InnerServer'
$silverlightInnerServerProjectPath = Join-Path $silverlightInnerServerProjectDir 'Winium.Silverlight.InnerServer.csproj'
&$nuget ('pack', $silverlightInnerServerProjectPath, '-IncludeReferencedProjects', '-Properties', 'Configuration=Release', '-OutputDirectory', $releaseDir)
}
Function PackRelease()
{
Add-Type -assembly "system.io.compression.filesystem"
$driverSourcePath = Join-Path $solutionDir "Winium.Mobile.Driver\bin\x86\Release"
$storeappsInnerServerSourcePath = Join-Path $solutionDir "Winium.StoreApps.InnerServer\bin\Release"
$silverlightInnerServerSourcePath = Join-Path $solutionDir "Winium.Silverlight.InnerServer\bin\Release"
$inspectorSourcePath = Join-Path $solutionDir "Winium.StoreApps.Inspector\bin\Release"
Get-ChildItem -Path $releaseDir -Filter "*.zip" | foreach ($_) { Remove-Item $_.FullName }
[IO.Compression.ZipFile]::CreateFromDirectory($driverSourcePath, "$releaseDir/Winium.Mobile.Driver.zip")
[IO.Compression.ZipFile]::CreateFromDirectory($storeappsInnerServerSourcePath, "$releaseDir/Winium.StoreApps.InnerServer.zip")
[IO.Compression.ZipFile]::CreateFromDirectory($silverlightInnerServerSourcePath, "$releaseDir/Winium.Silverlight.InnerServer.zip")
[IO.Compression.ZipFile]::CreateFromDirectory($inspectorSourcePath, "$releaseDir/Winium.StoreApps.Inspector.zip")
}
$workspace=$PSScriptRoot
$releaseDir = Join-Path $workspace "Release"
$solutionDir=Join-Path $workspace "Winium"
Write-Host "Update CHANGELOG.md"
Write-Host "Update version in Assemblies"
Write-Host "Update version in NuSpec file"
Pause
Clean
Build
Test
PackNuGet
PackRelease
Write-Host "Finished" -ForegroundColor Green
Write-Host "Publish Winium.StoreApps NuGet package using nuget.exe push $releaseDir\Winium.StoreApps.InnerServer.*.nupkg"
Write-Host "Publish Winium.Silverlight NuGet package using nuget.exe push $releaseDir\Winium.Silverlight.InnerServer.*.nupkg"
Write-Host "Add and push tag using git tag -a v*.*.* -m 'Version *.*.*'"
Write-Host "Upload and attach $releaseDir\*.zip files to release"