Skip to content

Commit

Permalink
Fix release version suffix for RC builds (#15865)
Browse files Browse the repository at this point in the history
  • Loading branch information
natke authored May 10, 2023
1 parent 95a4607 commit 36c9ae0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ parameters:
displayName: Suffix added to pre-release package version. Only used if IsReleaseBuild is true. Denotes the type of pre-release package.
type: string
values:
- -alpha
- -beta
- -rc
- alpha
- beta
- rc
- none
default: none

Expand Down Expand Up @@ -67,38 +67,39 @@ variables:
value: ''

stages:
- stage: Set_release_version_suffix
- stage: Setup
jobs:
- job:
- job: Set_Variables
steps:
- checkout: none
- bash: |
if [[ "${{ parameters.IsReleaseBuild }}" = True && "${{ parameters.PreReleaseVersionSuffixString }}" != "none" ]]; then
echo "##vso[task.setvariable variable=ReleaseVersionSuffix; isoutput=true]${{ parameters.PreReleaseVersionSuffixString }}.${{ parameters.PreReleaseVersionSuffixNumber }}"
if [[ "${{ parameters.PreReleaseVersionSuffixNumber }}" -eq 0 ]]; then
echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]-${{ parameters.PreReleaseVersionSuffixString }}"
else
echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]-${{ parameters.PreReleaseVersionSuffixString }}.${{ parameters.PreReleaseVersionSuffixNumber }}"
fi
else
echo "##vso[task.setvariable variable=ReleaseVersionSuffix; isoutput=true]''"
echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]"
fi
- bash: |
echo "IsReleaseBuild is: ${{ parameters.IsReleaseBuild }}"
echo "Pre-release version suffix is: ${{ parameters.PreReleaseVersionSuffixString }}"
echo "Pre-release version number is: ${{ parameters.PreReleaseVersionSuffixNumber }}"
echo "Release version suffix is: $(ReleaseVersionSuffix)"
name: Set_Release_Version_Suffix
- stage: Debug
dependsOn: Setup
jobs:
- job:
- job: D1
variables:
MyVar: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
steps:
- checkout: none
- bash: |
echo "Release version suffix is: $(ReleaseVersionSuffix)"
- bash: echo $(MyVar)

- template: templates/c-api-cpu.yml
parameters:
RunOnnxRuntimeTests: ${{ parameters.RunOnnxRuntimeTests }}
DoCompliance: ${{ parameters.DoCompliance }}
DoEsrp: ${{ parameters.DoEsrp }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
ReleaseVersionSuffix: $(ReleaseVersionSuffix)
OrtNugetPackageId: 'Microsoft.ML.OnnxRuntime'
AdditionalBuildFlags: ''
AdditionalWinBuildFlags: '--enable_onnx_tests --enable_wcos'
Expand Down Expand Up @@ -546,6 +547,7 @@ stages:

- stage: NuGet_Packaging_GPU
dependsOn:
- Setup
- Windows_Packaging_gpu
- Windows_Packaging_tensorrt
- Linux_C_API_Packaging_GPU_x64
Expand All @@ -560,6 +562,7 @@ stages:
pool: 'Azure-Pipelines-EO-Windows2022-aiinfra'
variables:
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]

steps:
- checkout: self
Expand Down
13 changes: 5 additions & 8 deletions tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ parameters:
type: boolean
default: false

- name: ReleaseVersionSuffix
displayName: Suffix added to release package name -alpha, -rc etc.
type: string
default: ""

- name: AdditionalBuildFlags
displayName: Additional build flags for build.py
type: string
Expand Down Expand Up @@ -289,6 +284,7 @@ stages:

- stage: NuGet_Packaging_CPU
dependsOn:
- Setup
- Linux_C_API_Packaging_CPU
- MacOS_C_API_Packaging_CPU
- Windows_Packaging_CPU_x86_${{ parameters.BuildVariant }}
Expand All @@ -308,6 +304,7 @@ stages:
variables:
OrtPackageId: ${{ parameters.OrtNugetPackageId }}
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]

steps:
- checkout: self
Expand Down Expand Up @@ -414,7 +411,7 @@ stages:
#
# 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine.
script: |
dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }}
dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
Expand All @@ -432,7 +429,7 @@ stages:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
platform: 'Any CPU'
configuration: RelWithDebInfo
msbuildArguments: '-p:SelectedTargets=PreNet6 -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }}'
msbuildArguments: '-p:SelectedTargets=PreNet6 -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- ${{ if eq(parameters.DoEsrp, true) }}:
Expand All @@ -457,7 +454,7 @@ stages:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
platform: 'Any CPU'
configuration: RelWithDebInfo
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }}'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: CopyFiles@2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ parameters:
type: boolean
default: false

- name: ReleaseVersionSuffix
displayName: Suffix added to release package name -alpha, -rc etc.
type: string
default: ""

- name: AdditionalBuildFlags
displayName: Additional build flags for build.py
type: string
Expand Down Expand Up @@ -131,6 +126,7 @@ stages:

- stage: NuGet_Packaging_Training_CPU
dependsOn:
- Setup
- Linux_C_API_Packaging_Training_CPU
- Windows_Packaging_Training_CPU_x86_${{ parameters.BuildVariant }}
- Windows_Packaging_Training_CPU_x64_${{ parameters.BuildVariant }}
Expand All @@ -148,6 +144,7 @@ stages:
variables:
OrtPackageId: ${{ parameters.OrtNugetPackageId }}
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]

steps:
- checkout: self
Expand Down Expand Up @@ -243,7 +240,7 @@ stages:
#
# 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine.
script: |
dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }}
dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
Expand Down

0 comments on commit 36c9ae0

Please sign in to comment.