@@ -506,6 +506,7 @@ stages:
506
506
507
507
- stage : Nodejs_Packaging
508
508
dependsOn :
509
+ - Setup
509
510
- Windows_Nodejs_Packaging_x64
510
511
- Windows_Nodejs_Packaging_arm64
511
512
- Linux_Nodejs_Packaging_x64
@@ -523,6 +524,8 @@ stages:
523
524
${{ if not(eq(parameters.IsReleaseBuild, true)) }} :
524
525
NpmPackagingMode : ' dev'
525
526
breakCodesignValidationInjection : ${{ parameters.DoEsrp }}
527
+ BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
528
+ BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
526
529
527
530
steps :
528
531
- checkout : self
@@ -717,10 +720,60 @@ stages:
717
720
*.node
718
721
TargetFolder : ' $(Build.SourcesDirectory)\js\node\bin\napi-v6\darwin\arm64'
719
722
723
+ - ${{ if not(eq(parameters.IsReleaseBuild, true)) }} :
724
+ - task : PowerShell@2
725
+ displayName : ' Set environment variable NODEJS_DEP_PACKAGE_VERSIONS'
726
+ inputs :
727
+ targetType : ' inline'
728
+ script : |
729
+ # The following PowerShell script is used to set environment variable "NODEJS_DEP_PACKAGE_VERSIONS" to the
730
+ # following format:
731
+ # <current_version>;<latest_existing_version>
732
+ #
733
+ # - The "current_version" is the same to the version of the Nuget package being built.
734
+ # - The "latest_existing_version" is the latest existing version of the package
735
+ # "Microsoft.ML.OnnxRuntime.Gpu.Linux" from the NuGet nightly feed.
736
+ #
737
+
738
+ $index = 'https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json'
739
+ $packageName = 'Microsoft.ML.OnnxRuntime.Gpu.Linux'
740
+
741
+ # Download NuGet index
742
+ $nugetIndex = Invoke-RestMethod -Uri $index -UseBasicParsing
743
+ if (-not $nugetIndex) {
744
+ throw "Failed to download NuGet index from $index"
745
+ }
746
+
747
+ # Find the base URL for "PackageBaseAddress/3.0.0"
748
+ $packageBaseUrl = ($nugetIndex.resources | Where-Object { $_.'@type' -eq 'PackageBaseAddress/3.0.0' }).'@id'
749
+ if (-not $packageBaseUrl) {
750
+ throw "Failed to find PackageBaseAddress in NuGet index"
751
+ }
752
+
753
+ # Fetch package version info
754
+ $packageInfo = Invoke-RestMethod -Uri "$packageBaseUrl$($packageName.ToLower())/index.json" -UseBasicParsing
755
+ if (-not $packageInfo.versions -or $packageInfo.versions.Count -eq 0) {
756
+ throw "No versions found for package $packageName"
757
+ }
758
+
759
+ # Extract the latest version
760
+ $devVersions = $packageInfo.versions | Where-Object { $_ -match '-dev-' }
761
+ $latestVersion = $devVersions[0]
762
+ Write-Host "Latest version of ${packageName}: $latestVersion"
763
+
764
+ # Generate current version
765
+ $currentVersion = "$(cat .\VERSION_NUMBER)-dev-$($env:BuildDate)-$($env:BuildTime)-$(git rev-parse --short HEAD)"
766
+ Write-Host "Current version: $currentVersion"
767
+
768
+ # Set the version as an environment variable
769
+ Write-Host "##vso[task.setvariable variable=NODEJS_DEP_PACKAGE_VERSIONS]$currentVersion;$latestVersion"
770
+ Write-Host "Environment variable NODEJS_DEP_PACKAGE_VERSIONS set to $currentVersion;$latestVersion"
771
+ workingDirectory : ' $(Build.SourcesDirectory)'
772
+
720
773
- task : PowerShell@2
721
774
inputs :
722
775
filePath : ' $(Build.SourcesDirectory)\tools\ci_build\github\js\pack-npm-packages.ps1'
723
- arguments : ' $(NpmPackagingMode) $(Build.SourcesDirectory) node'
776
+ arguments : ' $(NpmPackagingMode) " $(Build.SourcesDirectory)" node "$env:NODEJS_DEP_PACKAGE_VERSIONS" '
724
777
workingDirectory : $(Build.BinariesDirectory)
725
778
errorActionPreference : stop
726
779
displayName : ' Pack NPM packages'
0 commit comments