From 9d74b7de09250a0ca231a05d2723b6ef220f834f Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Fri, 25 Nov 2022 16:01:14 +0100 Subject: [PATCH 1/4] Update default UmbracoVersion template value using MSBuild target --- build/azure-pipelines.yml | 23 ++++--------------- templates/Umbraco.Templates.csproj | 19 +++++++++++++++ .../.template.config/template.json | 2 +- .../.template.config/template.json | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 345e3bde885e..10002d02fc28 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -86,31 +86,16 @@ stages: arguments: '--configuration $(buildConfiguration) --no-restore -p:ContinuousIntegrationBuild=true' - script: | version="$(Build.BuildNumber)" - echo "varsion: $version" + echo "Version: $version" major="$(echo $version | cut -d '.' -f 1)" - echo "major version: $major" + echo "Major version: $major" echo "##vso[task.setvariable variable=majorVersion;isOutput=true]$major" displayName: Set major version name: determineMajorVersion - - task: PowerShell@2 - displayName: Prepare nupkg - inputs: - targetType: inline - script: | - $umbracoVersion = "$(Build.BuildNumber)" -replace "\+",".g" - $templatePaths = Get-ChildItem 'templates/**/.template.config/template.json' - - foreach ($templatePath in $templatePaths) { - $a = Get-Content $templatePath -Raw | ConvertFrom-Json - if ($a.symbols -and $a.symbols.UmbracoVersion) { - $a.symbols.UmbracoVersion.defaultValue = $umbracoVersion - $a | ConvertTo-Json -Depth 32 | Set-Content $templatePath - } - } - - dotnet pack $(solution) --configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)/nupkg + - script: dotnet pack $(solution) --configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)/nupkg + displayName: Run dotnet pack - script: | sha="$(Build.SourceVersion)" sha=${sha:0:7} diff --git a/templates/Umbraco.Templates.csproj b/templates/Umbraco.Templates.csproj index 10bbd666d1b2..600f72b37301 100644 --- a/templates/Umbraco.Templates.csproj +++ b/templates/Umbraco.Templates.csproj @@ -8,6 +8,7 @@ true true . + NU5128 @@ -42,4 +43,22 @@ UmbracoProject\wwwroot + + + + + + + + + <_TemplateJsonFiles Include="**\.template.config\template.json" Exclude="bin\**;obj\**" /> + + + + + <_PackageFiles Include="@(_TemplateJsonFiles->'$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension)')"> + %(RelativeDir) + + + diff --git a/templates/UmbracoPackage/.template.config/template.json b/templates/UmbracoPackage/.template.config/template.json index 36c93da093c8..e54306283f8c 100644 --- a/templates/UmbracoPackage/.template.config/template.json +++ b/templates/UmbracoPackage/.template.config/template.json @@ -41,7 +41,7 @@ "description": "The version of Umbraco.Cms to add as PackageReference.", "type": "parameter", "datatype": "string", - "defaultValue": "10.0.0-rc1", + "defaultValue": "*", "replaces": "UMBRACO_VERSION_FROM_TEMPLATE" }, "Namespace": { diff --git a/templates/UmbracoProject/.template.config/template.json b/templates/UmbracoProject/.template.config/template.json index befe6d7e5af6..d88b23c07d1a 100644 --- a/templates/UmbracoProject/.template.config/template.json +++ b/templates/UmbracoProject/.template.config/template.json @@ -51,7 +51,7 @@ "description": "The version of Umbraco.Cms to add as PackageReference.", "type": "parameter", "datatype": "string", - "defaultValue": "10.0.0-rc1", + "defaultValue": "*", "replaces": "UMBRACO_VERSION_FROM_TEMPLATE" }, "UseHttpsRedirect": { From f050a5b39b71a34faa4c81289875aa81fe945ec9 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Fri, 25 Nov 2022 22:59:01 +0100 Subject: [PATCH 2/4] Fix target order when using pack --no-build --- templates/Umbraco.Templates.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/Umbraco.Templates.csproj b/templates/Umbraco.Templates.csproj index 600f72b37301..5cab5adfd76b 100644 --- a/templates/Umbraco.Templates.csproj +++ b/templates/Umbraco.Templates.csproj @@ -48,7 +48,7 @@ - + <_TemplateJsonFiles Include="**\.template.config\template.json" Exclude="bin\**;obj\**" /> @@ -56,6 +56,7 @@ + <_PackageFiles Remove="**\.template.config\template.json" /> <_PackageFiles Include="@(_TemplateJsonFiles->'$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension)')"> %(RelativeDir) From 307fd7c57be0dc62830b5d97b1023407f9dd5ab1 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Tue, 29 Nov 2022 10:41:12 +0100 Subject: [PATCH 3/4] Use JsonPathUpdateValue MSBuild task to update default UmbracoVersion template value --- .../Umbraco.Cms.Targets.csproj | 2 +- templates/Umbraco.Templates.csproj | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Cms.Targets/Umbraco.Cms.Targets.csproj b/src/Umbraco.Cms.Targets/Umbraco.Cms.Targets.csproj index 056eb09513c0..a5baf6dcbb62 100644 --- a/src/Umbraco.Cms.Targets/Umbraco.Cms.Targets.csproj +++ b/src/Umbraco.Cms.Targets/Umbraco.Cms.Targets.csproj @@ -24,7 +24,7 @@ NU5100;NU5128 - + diff --git a/templates/Umbraco.Templates.csproj b/templates/Umbraco.Templates.csproj index 5cab5adfd76b..051318a02e5d 100644 --- a/templates/Umbraco.Templates.csproj +++ b/templates/Umbraco.Templates.csproj @@ -44,20 +44,22 @@ - + - + - - + <_TemplateJsonFiles Include="**\.template.config\template.json" Exclude="bin\**;obj\**" /> + <_TemplateJsonFiles> + $(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension) + - - + + - <_PackageFiles Remove="**\.template.config\template.json" /> - <_PackageFiles Include="@(_TemplateJsonFiles->'$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension)')"> + <_PackageFiles Remove="@(_TemplateJsonFiles)" /> + <_PackageFiles Include="%(_TemplateJsonFiles.DestinationFile)"> %(RelativeDir) From d6cf6ff960996b7bb614b3c1f152d8a5981c0413 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Wed, 5 Apr 2023 10:52:41 +0200 Subject: [PATCH 4/4] Update UmbracoVersion in Umbraco Package RCL --- templates/UmbracoPackageRcl/.template.config/template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/UmbracoPackageRcl/.template.config/template.json b/templates/UmbracoPackageRcl/.template.config/template.json index c61289f6c283..be7b1c04e87a 100644 --- a/templates/UmbracoPackageRcl/.template.config/template.json +++ b/templates/UmbracoPackageRcl/.template.config/template.json @@ -42,7 +42,7 @@ "description": "The version of Umbraco.Cms to add as PackageReference.", "type": "parameter", "datatype": "string", - "defaultValue": "11.0.0", + "defaultValue": "*", "replaces": "UMBRACO_VERSION_FROM_TEMPLATE" }, "SkipRestore": {