@@ -70,9 +70,67 @@ extends:
7070 - repository : neutron-server
7171 - repository : test-data-shared
7272 stages :
73+ # ── Compute Version ──
74+ # A single version string is computed once and shared across all stages.
75+ # This prevents timestamp drift between standard and WinML builds.
76+ # Outputs three format variants:
77+ # sdkVersion – semver for JS, C#, Rust (e.g. 1.0.0-dev.202604061234)
78+ # pyVersion – PEP 440 for Python (e.g. 1.0.0.dev202604061234)
79+ # flcVersion – NuGet/FLC style (e.g. 1.0.0-dev-202604061234-ab12cd34)
80+ - stage : compute_version
81+ displayName : ' Compute Version'
82+ dependsOn : []
83+ jobs :
84+ - job : version
85+ displayName : ' Compute Version'
86+ pool :
87+ name : onnxruntime-Win-CPU-2022
88+ os : windows
89+ templateContext :
90+ outputs :
91+ - output : pipelineArtifact
92+ artifactName : ' version-info'
93+ targetPath : ' $(Build.ArtifactStagingDirectory)/version-info'
94+ steps :
95+ - checkout : none
96+ - task : PowerShell@2
97+ displayName : ' Compute and write version files'
98+ inputs :
99+ targetType : inline
100+ script : |
101+ $base = "${{ parameters.version }}"
102+ $preId = "${{ parameters.prereleaseId }}"
103+ $ts = Get-Date -Format "yyyyMMddHHmm"
104+ $commitId = "$(Build.SourceVersion)".Substring(0, 8)
105+
106+ if ($preId -ne '' -and $preId -ne 'none') {
107+ $sdkVersion = "$base-$preId"
108+ $pyVersion = "$base$preId"
109+ $flcVersion = "$base-$preId"
110+ } elseif ("${{ parameters.isRelease }}" -ne "True") {
111+ $sdkVersion = "$base-dev.$ts"
112+ $pyVersion = "$base.dev$ts"
113+ $flcVersion = "$base-dev-$ts-$commitId"
114+ } else {
115+ $sdkVersion = $base
116+ $pyVersion = $base
117+ $flcVersion = $base
118+ }
119+
120+ $outDir = "$(Build.ArtifactStagingDirectory)/version-info"
121+ New-Item -ItemType Directory -Path $outDir -Force | Out-Null
122+ Set-Content -Path "$outDir/sdkVersion.txt" -Value $sdkVersion -NoNewline
123+ Set-Content -Path "$outDir/pyVersion.txt" -Value $pyVersion -NoNewline
124+ Set-Content -Path "$outDir/flcVersion.txt" -Value $flcVersion -NoNewline
125+
126+ Write-Host "SDK version: $sdkVersion"
127+ Write-Host "Python version: $pyVersion"
128+ Write-Host "FLC version: $flcVersion"
129+
73130 # ── Build & Test FLC ──
74131 - stage : build_core
75132 displayName : ' Build & Test FLC'
133+ dependsOn : compute_version
76134 jobs :
77135 - job : flc_win_x64
78136 displayName : ' FLC win-x64'
@@ -160,6 +218,10 @@ extends:
160218 name : onnxruntime-Win-CPU-2022
161219 os : windows
162220 templateContext :
221+ inputs :
222+ - input : pipelineArtifact
223+ artifactName : ' version-info'
224+ targetPath : ' $(Pipeline.Workspace)/version-info'
163225 outputs :
164226 - output : pipelineArtifact
165227 artifactName : ' flc-nuget'
@@ -229,6 +291,9 @@ extends:
229291 os : windows
230292 templateContext :
231293 inputs :
294+ - input : pipelineArtifact
295+ artifactName : ' version-info'
296+ targetPath : ' $(Pipeline.Workspace)/version-info'
232297 - input : pipelineArtifact
233298 artifactName : ' flc-nuget'
234299 targetPath : ' $(Pipeline.Workspace)/flc-nuget'
@@ -261,6 +326,9 @@ extends:
261326 os : windows
262327 templateContext :
263328 inputs :
329+ - input : pipelineArtifact
330+ artifactName : ' version-info'
331+ targetPath : ' $(Pipeline.Workspace)/version-info'
264332 - input : pipelineArtifact
265333 artifactName : ' flc-nuget'
266334 targetPath : ' $(Pipeline.Workspace)/flc-nuget'
@@ -293,6 +361,9 @@ extends:
293361 os : windows
294362 templateContext :
295363 inputs :
364+ - input : pipelineArtifact
365+ artifactName : ' version-info'
366+ targetPath : ' $(Pipeline.Workspace)/version-info'
296367 - input : pipelineArtifact
297368 artifactName : ' flc-wheels'
298369 targetPath : ' $(Pipeline.Workspace)/flc-wheels'
@@ -325,6 +396,9 @@ extends:
325396 os : windows
326397 templateContext :
327398 inputs :
399+ - input : pipelineArtifact
400+ artifactName : ' version-info'
401+ targetPath : ' $(Pipeline.Workspace)/version-info'
328402 - input : pipelineArtifact
329403 artifactName : ' flc-nuget'
330404 targetPath : ' $(Pipeline.Workspace)/flc-nuget'
@@ -467,7 +541,7 @@ extends:
467541 # ── Build & Test FLC (WinML) ──
468542 - stage : build_core_winml
469543 displayName : ' Build & Test FLC WinML'
470- dependsOn : []
544+ dependsOn : compute_version
471545 jobs :
472546 - job : flc_winml_win_x64
473547 displayName : ' FLC win-x64 (WinML)'
@@ -520,6 +594,10 @@ extends:
520594 name : onnxruntime-Win-CPU-2022
521595 os : windows
522596 templateContext :
597+ inputs :
598+ - input : pipelineArtifact
599+ artifactName : ' version-info'
600+ targetPath : ' $(Pipeline.Workspace)/version-info'
523601 outputs :
524602 - output : pipelineArtifact
525603 artifactName : ' flc-nuget-winml'
@@ -575,6 +653,9 @@ extends:
575653 os : windows
576654 templateContext :
577655 inputs :
656+ - input : pipelineArtifact
657+ artifactName : ' version-info'
658+ targetPath : ' $(Pipeline.Workspace)/version-info'
578659 - input : pipelineArtifact
579660 artifactName : ' flc-nuget-winml'
580661 targetPath : ' $(Pipeline.Workspace)/flc-nuget-winml'
@@ -608,6 +689,9 @@ extends:
608689 os : windows
609690 templateContext :
610691 inputs :
692+ - input : pipelineArtifact
693+ artifactName : ' version-info'
694+ targetPath : ' $(Pipeline.Workspace)/version-info'
611695 - input : pipelineArtifact
612696 artifactName : ' flc-nuget-winml'
613697 targetPath : ' $(Pipeline.Workspace)/flc-nuget-winml'
@@ -640,6 +724,9 @@ extends:
640724 os : windows
641725 templateContext :
642726 inputs :
727+ - input : pipelineArtifact
728+ artifactName : ' version-info'
729+ targetPath : ' $(Pipeline.Workspace)/version-info'
643730 - input : pipelineArtifact
644731 artifactName : ' flc-wheels-winml'
645732 targetPath : ' $(Pipeline.Workspace)/flc-wheels-winml'
@@ -673,6 +760,9 @@ extends:
673760 os : windows
674761 templateContext :
675762 inputs :
763+ - input : pipelineArtifact
764+ artifactName : ' version-info'
765+ targetPath : ' $(Pipeline.Workspace)/version-info'
676766 - input : pipelineArtifact
677767 artifactName : ' flc-nuget-winml'
678768 targetPath : ' $(Pipeline.Workspace)/flc-nuget-winml'
0 commit comments