onnxruntime/tools/ci_build/github/azure-pipelines/nuget/templates/get-nuget-package-version-as-variable.yml
2020-05-19 15:28:30 -07:00

40 lines
1.6 KiB
YAML

parameters:
packageFolder: $(Build.ArtifactStagingDirectory)
steps:
- task: CmdLine@2
condition: eq(variables['Agent.OS'], 'Windows_NT')
displayName: 'Extract version number from the NuPkg file, Windows VMs'
inputs:
workingDirectory: '${{ parameters.packageFolder }}'
script: |
SETLOCAL EnableDelayedExpansion
FOR /R %%i IN (Microsoft.ML.OnnxRuntime.Managed*.nupkg) do (
set filename=%%~ni
set ortversion=!filename:~33!
@echo ortversion is !ortversion!
@echo ##vso[task.setvariable variable=NuGetPackageVersionNumber;]!ortversion!
)
- task: CmdLine@2
condition: eq(variables['Agent.OS'], 'Windows_NT')
displayName: 'Extract version number from the DirectML NuPkg file, Windows VMs'
inputs:
workingDirectory: '${{ parameters.packageFolder }}'
script: |
SETLOCAL EnableDelayedExpansion
FOR /R %%i IN (Microsoft.ML.OnnxRuntime.DirectML*.nupkg) do (
set filename=%%~ni
set ortversion=!filename:~34!
@echo DirectMLNuGetPackageVersionNumber is !ortversion!
@echo ##vso[task.setvariable variable=DirectMLNuGetPackageVersionNumber;]!ortversion!
)
- task: CmdLine@2
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
displayName: 'Extract version number from the NuPkg file, Unix VMs'
inputs:
workingDirectory: '${{ parameters.packageFolder }}'
script: |
filenamewithext=$(ls Microsoft.ML.OnnxRuntime.Managed*nupkg)
filename=${filenamewithext%.*}
ortversion=${filename:33}
echo "##vso[task.setvariable variable=NuGetPackageVersionNumber;]$ortversion"