Fix artifact build and ensure the version of future templates are also updated

This commit is contained in:
Ronald Barendse
2022-02-24 10:42:59 +01:00
parent 2dc9ccda6d
commit 05d606d6a7

View File

@@ -396,42 +396,25 @@ stages:
$ubuild = build/build.ps1 -get -continue
$version = $ubuild.GetUmbracoVersion()
$isRelease = [regex]::matches($env:BUILD_SOURCEBRANCH,"v\d+\/\d+.\d+.*")
if ($isRelease.Count -gt 0){
if ($isRelease.Count -gt 0) {
$continuous = $version.Semver
}
else
{
} else {
$date = (Get-Date).ToString("yyyyMMdd")
$continuous = "$($version.release)-preview$date.$(Build.BuildId)"
$ubuild.SetUmbracoVersion($continuous)
#Update the version in templates also
$templatePath =
'build/templates/UmbracoProject/.template.config/template.json'
$a = Get-Content $templatePath -raw | ConvertFrom-Json
$a.symbols.version.defaultValue = $continuous
$a | ConvertTo-Json -depth 32| set-content $templatePath
$templatePath =
'build/templates/UmbracoPackage/.template.config/template.json'
$a = Get-Content $templatePath -raw | ConvertFrom-Json
$a.symbols.version.defaultValue = $continuous
$a | ConvertTo-Json -depth 32| set-content $templatePath
}
# Update the version in templates
$templatePaths = Get-ChildItem 'templates/**/.template.config/template.json'
foreach ($templatePath in $templatePaths) {
$a = Get-Content $templatePath -Raw | ConvertFrom-Json
$a.symbols.version.defaultValue = $continuous
$a | ConvertTo-Json -Depth 32 | Set-Content $templatePath
}
}
Write-Host "##vso[build.updatebuildnumber]$continuous.$(Build.BuildId)"