2222 $dateTime = [datetime]::new($dateTime.Ticks - ($dateTime.Ticks % [timespan]::TicksPerSecond), $dateTime.Kind)
2323
2424 $metadata = Get-Content ./tools/metadata.json | ConvertFrom-Json
25- $stableRelease = $metadata.StableRelease
26- $ltsRelease = $metadata.LTSRelease
25+ $stableRelease = $metadata.StableRelease.Latest
26+ $ltsRelease = $metadata.LTSRelease.Latest
27+
2728 $buildInfo = Get-Content $jsonFile | ConvertFrom-Json
2829 $buildInfo.ReleaseDate = $dateTime
2930
@@ -38,17 +39,27 @@ steps:
3839 Write-Host "sending " + $vstsCommandString
3940 Write-Host "##$vstsCommandString"
4041
41-
4242 ## Create 'lts.json' if it's the latest stable and also a LTS release.
4343
4444 $vstsCommandCopyLTSBuildInfo = "vso[task.setvariable variable=CopyLTSBuildInfo]NO"
45+ $vstsCommandCopyVersionBuildInfo = "vso[task.setvariable variable=CopyVersionBuildInfo]NO"
4546
46- if ($fileName -eq "stable.json" -and $ltsRelease)
47- {
48- $ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
49- Copy-Item -Path $targetFile -Destination $ltsFile -Force
50- $vstsCommandLtsJsonFile = "vso[task.setvariable variable=LtsBuildInfoJsonFile]$ltsFile"
51- $vstsCommandCopyLTSBuildInfo = "vso[task.setvariable variable=CopyLTSBuildInfo]YES"
47+ if ($fileName -eq "stable.json") {
48+ if ($ltsRelease) {
49+ $ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
50+ Copy-Item -Path $targetFile -Destination $ltsFile -Force
51+ $vstsCommandLtsJsonFile = "vso[task.setvariable variable=LtsBuildInfoJsonFile]$ltsFile"
52+ $vstsCommandCopyLTSBuildInfo = "vso[task.setvariable variable=CopyLTSBuildInfo]YES"
53+ }
54+
55+ $releaseTag = $buildInfo.ReleaseTag
56+ $version = $releaseTag -replace '^v'
57+ $semVersion = [System.Management.Automation.SemanticVersion] $version
58+
59+ $versionFile = "$ENV:PIPELINE_WORKSPACE/$($semVersion.Major)-$($semVersion.Minor).json"
60+ Copy-Item -Path $targetFile -Destination $versionFile -Force
61+ $vstsCommandVersionJsonFile = "vso[task.setvariable variable=VersionBuildInfoJsonFile]$versionFile"
62+ $vstsCommandCopyVersionBuildInfo = "vso[task.setvariable variable=CopyVersionBuildInfo]YES"
5263 }
5364
5465 Write-Host "sending " + $vstsCommandCopyLTSBuildInfo
@@ -59,6 +70,15 @@ steps:
5970 Write-Host "sending " + $vstsCommandLtsJsonFile
6071 Write-Host "##$vstsCommandLtsJsonFile"
6172 }
73+
74+ Write-Host "sending " + $vstsCommandCopyVersionBuildInfo
75+ Write-Host "##$vstsCommandCopyVersionBuildInfo"
76+
77+ if ($vstsCommandVersionJsonFile)
78+ {
79+ Write-Host "sending " + $vstsCommandVersionJsonFile
80+ Write-Host "##$vstsCommandVersionJsonFile"
81+ }
6282 displayName : Download and Capture NuPkgs
6383
6484- task : AzureFileCopy@2
@@ -80,3 +100,13 @@ steps:
80100 storage : ' $(StorageAccount)'
81101 ContainerName : BuildInfo
82102 condition : and(succeeded(), eq(variables['CopyLTSBuildInfo'], 'YES'))
103+
104+ - task : AzureFileCopy@2
105+ displayName : ' AzureBlob build info '' Major-Minor.json'' Copy when needed'
106+ inputs :
107+ SourcePath : ' $(VersionBuildInfoJsonFile)'
108+ azureSubscription : ' $(AzureFileCopySubscription)'
109+ Destination : AzureBlob
110+ storage : ' $(StorageAccount)'
111+ ContainerName : BuildInfo
112+ condition : and(succeeded(), eq(variables['CopyVersionBuildInfo'], 'YES'))
0 commit comments