Skip to content

Commit c3933cc

Browse files
TravisEz13daviwil
authored andcommitted
add release build entrypoint
1 parent b229307 commit c3933cc

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tools/releaseBuild/vstsbuild.ps1

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
param(
2+
[ValidateSet('win')]
3+
[String]
4+
$Name
5+
)
6+
7+
$ErrorActionPreference = 'Stop'
8+
9+
$psReleaseBranch = 'master'
10+
$psReleaseFork = 'PowerShell'
11+
$location = Join-Path -Path $PSScriptRoot -ChildPath 'PSRelease'
12+
if(Test-Path $location)
13+
{
14+
Remove-Item -Path $location -Recurse -Force
15+
}
16+
17+
$gitBinFullPath = (Get-Command -Name git).Source
18+
if (-not $gitBinFullPath)
19+
{
20+
throw "Git is required to proceed. Install from 'https://git-scm.com/download/win'"
21+
}
22+
23+
Write-Verbose "cloning -b $psReleaseBranch --quiet https://github.com/$psReleaseFork/PSRelease.git" -verbose
24+
& $gitBinFullPath clone -b $psReleaseBranch --quiet https://github.com/$psReleaseFork/PSRelease.git $location
25+
26+
Push-Location -Path $PWD.Path
27+
try{
28+
Set-Location $location
29+
& $gitBinFullPath submodule update --init --recursive --quiet
30+
}
31+
finally
32+
{
33+
Pop-Location
34+
}
35+
36+
$unresolvedRepoRoot = Join-Path -Path $PSScriptRoot '../..'
37+
$resolvedRepoRoot = (Resolve-Path -Path $unresolvedRepoRoot).ProviderPath
38+
39+
try
40+
{
41+
Write-Verbose "Starting build at $resolvedRepoRoot ..." -Verbose
42+
Import-Module "$location/vstsBuild" -Force
43+
Import-Module "$location/dockerBasedBuild" -Force
44+
Clear-VstsTaskState
45+
46+
Invoke-Build -RepoPath $resolvedRepoRoot -BuildJsonPath './tools/releaseBuild/build.json' -Name $Name -Parameters $PSBoundParameters
47+
}
48+
catch
49+
{
50+
Write-VstsError -Error $_
51+
}
52+
finally{
53+
Write-VstsTaskState
54+
exit 0
55+
}

0 commit comments

Comments
 (0)