-
Notifications
You must be signed in to change notification settings - Fork 6
/
CreateRelease.ps1
76 lines (59 loc) · 2.37 KB
/
CreateRelease.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
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSCommandPath
Push-Location $root
$vsPath = .\vswhere.exe -latest -requires 'Microsoft.Component.MSBuild' -property installationPath
if ($vsPath -eq $null) {
Write-Host "Failed to find Visual Studio Install"
Pop-Location
exit -1
}
$vsPath = Join-Path $vsPath 'MSBuild\Current\Bin\MSBuild.exe'
& $vsPath .\AlteryxAbacus.sln /t:Rebuild /p:Configuration=Release
if ($LASTEXITCODE -ne 0) {
Write-Host "Build Failed"
Pop-Location
exit -1
}
Copy-Item .\x64\Release\AlteryxAbacus.dll .
& .\Install.bat
if ($LASTEXITCODE -ne 0) {
Pop-Location
exit -1
}
.\RunUnitTests.ps1
if ($LASTEXITCODE -ne 0) {
Pop-Location
exit -1
}
$dllFile = Join-Path $root "AlteryxAbacus.dll"
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dllFile).FileVersion
Write-Host "Building ReadMe.pdf ..."
& pandoc -f gfm -t pdf README.md -o README.pdf
if ($LASTEXITCODE -ne 0) {
$message = "Documentation failed (you need pandoc): " + $LASTEXITCODE
Write-Host $message
Pop-Location
exit -1
}
$readMePdf = Join-Path $root "Readme.pdf"
Write-Host "Building Manual ..."
if (Test-Path "$root\FunctionManual.md") {
Remove-Item "$root\FunctionManual.md"
}
Get-Content "$root\..\AlteryxFormulaAddOns.wiki\Function-List.md" -Raw | Add-Content "$root\FunctionManual.md"
Get-ChildItem "$root\..\AlteryxFormulaAddOns.wiki\*.xml).md" | Get-Content -Raw | Add-Content "$root\FunctionManual.md"
$text = (Get-Content "$root\FunctionManual.md" -Raw)
$text = $text -replace "\[([^\]]+)\]\([^#]+#([^)]+)\)", '[$1](#$2)'
Set-Content "$root\FunctionManual.md" $text
& pandoc -f gfm -t pdf FunctionManual.md -o Manual.pdf
Remove-Item "$root\FunctionManual.md"
$readMePdf = Join-Path $root "Manual.pdf"
Write-Host "Removing bak files ..."
Remove-Item *.bak -Recurse
$output = "$root\AlteryxAbacus v$version.zip"
Compress-Archive -Path ("$root\*.dll", "$root\*Utils.xml", "$root\README.pdf", "$root\Manual.pdf", "$root\Install.bat", "$root\Install Win7.bat", "$root\Installer.ps1", "$root\Uninstall.bat", "$root\Uninstall Win7.bat", "$root\Uninstaller.ps1") -DestinationPath $output -Verbose -Update
Remove-Item "$root\README.pdf"
Remove-Item "$root\Manual.pdf"
$output = "$root\AlteryxAbacus v$version Tests.zip"
Compress-Archive -Path ("$root\*.Test", "$root\*.yxm*", "*.png") -DestinationPath $output -Verbose -Update
Pop-Location