我正在尝试使用Powershell根据触发的分支设置BuildConfiguration
有人知道如何做到这一点吗?
switch($env:Build.SourceBranchName) {
'master' {$env:BuildConfiguration = Release; break;}
'staging' {$env:BuildConfiguration = Staging; break;}
'develop' {$env:BuildConfiguration = Dev; break;}
}
最佳答案
终于有了这个工作
switch(${env:BUILD_SOURCEBRANCH}) {
'refs/heads/master' {Write-Host "##vso[task.setvariable variable=BuildConfiguration]Release"; }
'refs/heads/staging' {Write-Host "##vso[task.setvariable variable=BuildConfiguration]Staging"; }
'refs/heads/develop' {Write-Host "##vso[task.setvariable variable=BuildConfiguration]Dev"; }
}
关于天青管道-根据触发分支设置变量,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58125396/