Add ADO parameter for nuget version suffix (#455)

* update nuget version to rc

* add ADO parameter for nuget version suffix

* remove is_for_nuget_publish

---------

Co-authored-by: Sayan Shaw <sayanshaw@microsoft.com>
This commit is contained in:
Sayan Shaw 2023-05-25 13:35:53 -07:00 коммит произвёл GitHub
Родитель 32e76e17b3
Коммит 30aa8f1315
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 12 добавлений и 16 удалений

Просмотреть файл

@ -14,10 +14,10 @@ parameters:
type: boolean
default: false
- name: IsForNugetPublish
displayName: Is this for publishing to nuget.org? If so, set to true, and update version info.
type: boolean
default: false
- name: NugetVersionSuffix
displayName: Update nuget version suffix (e.g. alpha/beta/rc, only if publishing to nuget.org, otherwise leave as "none").
type: string
default: none
trigger:
branches:
@ -35,5 +35,5 @@ stages:
DoCompliance: ${{ parameters.DoCompliance }}
DoEsrp: ${{ parameters.DoEsrp }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
IsForNugetPublish: ${{ parameters.IsForNugetPublish }}
NugetVersionSuffix: ${{ parameters.NugetVersionSuffix }}
OrtNugetPackageId: 'Microsoft.ML.OnnxRuntime.Extensions'

Просмотреть файл

@ -14,10 +14,9 @@ parameters:
type: boolean
default: false
- name: IsForNugetPublish
displayName: Is for publish to nuget.org?
type: boolean
default: false
- name: NugetVersionSuffix
displayName: Nuget version suffix
type: string
- name: OrtNugetPackageId
displayName: Package name for nuget
@ -225,7 +224,7 @@ stages:
--package_version $OrtExtVersion `
--commit_id $(Build.SourceVersion) `
--is_release_build ${{ parameters.IsReleaseBuild }} `
--is_for_nuget_publish ${{ parameters.IsForNugetPublish }}
--nuget_version_suffix ${{ parameters.NugetVersionSuffix }}
cat $(Build.SourcesDirectory)\nuget\NativeNuget.nuspec
workingDirectory: '$(Build.SourcesDirectory)'

Просмотреть файл

@ -21,10 +21,8 @@ def update_nuspec(args):
if package_item.tag == "version" and args.package_version:
if args.is_release_build:
package_item.text = args.package_version
elif args.is_for_nuget_publish:
# Update version_suffix below if publishing to NuGet
version_suffix = "beta" # alpha/beta/rc
package_item.text = f"{args.package_version}-{version_suffix}"
elif args.nuget_version_suffix != "none":
package_item.text = f"{args.package_version}-{args.nuget_version_suffix}"
else:
import datetime
now = datetime.datetime.now().strftime('%Y%m%d-%H%M')
@ -55,12 +53,11 @@ def parse_arguments():
help="Path to nuspec file to update.")
parser.add_argument("--commit_id", required=True, help="The last commit id included in this package.")
parser.add_argument("--is_release_build", default="False", type=str, help="If it's a release build.")
parser.add_argument("--is_for_nuget_publish", default="False", type=str, help="If it's for publishing to nuget.org.")
parser.add_argument("--nuget_version_suffix", type=str, help="Nuget version suffix (needed if publishing to nuget.org and not release build)")
args = parser.parse_args()
args.nuspec_path = args.nuspec_path.resolve(strict=True)
args.is_release_build = args.is_release_build.lower() == "true"
args.is_for_nuget_publish = args.is_for_nuget_publish.lower() == "true"
print("used args:", args)
return args