Skip to content

Commit

Permalink
corrected detection of CIBUILD as that state was missing and ended up…
Browse files Browse the repository at this point in the history
… defaulting to localbuild
  • Loading branch information
smaillet committed Mar 7, 2020
1 parent 134d969 commit 2575e51
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions buildutils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,16 @@ function Get-CurrentBuildKind
$currentBuildKind = [BuildKind]::LocalBuild

# IsAutomatedBuild is the top level gate (e.g. if it is false, all the others must be false)
$isAutomatedBuild = $env:CI `
-or $env:APPVEYOR `
-or $env:GITHUB_ACTIONS
$isAutomatedBuild = [System.Convert]::ToBoolean($env:CI) `
-or [System.Convert]::ToBoolean($env:APPVEYOR) `
-or [System.Convert]::ToBoolean($env:GITHUB_ACTIONS)

if( $isAutomatedBuild )
{
# PR and release builds have externally detected indicators that are tested
# below, so default to a CiBuild (e.g. not a PR, And not a RELEASE)
$currentBuildKind = [BuildKind]::CiBuild

# IsPullRequestBuild indicates an automated buddy build and should not be trusted
$isPullRequestBuild = $env:GITHUB_BASE_REF -or $env:APPVEYOR_PULL_REQUEST_NUMBER

Expand All @@ -367,11 +371,11 @@ function Get-CurrentBuildKind
}
else
{
if($env:APPVEYOR)
if([System.Convert]::ToBoolean($env:APPVEYOR))
{
$isReleaseBuild = $env:APPVEYOR_REPO_TAG
}
elseif($env:GITHUB_ACTIONS)
elseif([System.Convert]::ToBoolean($env:GITHUB_ACTIONS))
{
$isReleaseBuild = $env:GITHUB_REF -like 'refs/tags/*'
}
Expand Down Expand Up @@ -450,6 +454,7 @@ function Initialize-BuildEnvironment

Write-Information "MSBUILD:`n$($msbuild | Format-Table -AutoSize | Out-String)"
Write-Information (dir env:Is* | Format-Table -Property Name, value | Out-String)
Write-Information (dir env:GITHUB* | Format-Table -Property Name, value | Out-String)
Write-Information "BuildKind: $global:CurrentBuildKind"
Write-Information "CiBuildName: $env:CiBuildName"
Write-Information 'PATH:'
Expand Down

0 comments on commit 2575e51

Please sign in to comment.