maui-linux/build/steps/build-prepare.yml

77 строки
2.3 KiB
YAML

steps:
- powershell: |
$sourceBranchName = "" + $env:BUILD_SOURCEBRANCHNAME
$sourceBranch = "" + $env:BUILD_SOURCEBRANCH
$publicTags = "" + $env:PUBLICTAGS
$tags = New-Object System.Collections.ArrayList
$buildId = "" + $env:BUILD_BUILDID
$sorceV = "" + $env:BUILD_SOURCEVERSION
$sign = "" + $env:SIGN
$reason = "" + $env:BUILD_REASON
echo $sorceV
echo $sourceBranchName
echo $sourceBranch
echo $publicTags
if($sourceBranch)
{
$branchParts = $sourceBranch.Split('/')
if($branchParts.Count -eq 1)
{
$tags.Add($branchParts[0] +"-release");
}
if($branchParts.Count -eq 3)
{
if($branchParts[1] -contains "heads")
{
$branchName = $branchParts[2]
$tags.Add($branchName+"-release")
}
}
if($branchParts.Count -eq 4)
{
if($branchParts[1] -contains "pull")
{
$tags.Add("pull-release");
$tags.Add("pr-"+$branchParts[2]);
}
if($branchParts[1] -contains "heads")
{
$branchName = $branchParts[2] + "-" +$branchParts[3]
$tags.Add($branchName+"-release")
}
}
}
if($reason -eq "Schedule")
{
$tags.Add("nightly-release")
}
#Tag this build
#check PublicTags also add them to the tag list
foreach($publicTag in $publicTags.Split(';'))
{
if($publicTag){
$tags.Add($publicTag);
}
}
#Add tags to the VSTS Build
foreach ($tag in $tags) {
if($tag -eq "public-release")
{
$sign = 'true'
}
if($tag -eq "nightly-release")
{
$sign = 'true'
}
Write-Host "##vso[build.addbuildtag]$tag"
}
Write-Host "Sign: $sign"
$publicTags = $tags -join ';'
Write-Host "##vso[task.setvariable variable=publictags;isOutput=true;]$publicTags"
Write-Host "##vso[task.setvariable variable=signnuget;isOutput=true;]$sign"
displayName: 'Tag and name build'
name: prepare