Is there an option to promote universal package view with azure devops yaml task?
There is no option to promote universal package view in UniversalPackages @0
task. As a workaround, besides using extension, you can also promote universal package view through script in powershell task.
$token = "Enter your Pat here"
$url = "https://pkgs.dev.azure.com/OrgName/ProjectName/_apis/packaging/feeds/FeedID/upack/packagesbatch?api-version=5.1-preview.1"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))
$JSON = @'
{
"data": {
"viewId": "Release"
},
"operation": 0,
"packages": [{
"id": "YourPackageName",
"version": "PackageVersion",
"protocolType": "upack"
}]
}
'@
$response = Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic $token"} -Method Post -ContentType application/json -body $JSON
Enter your own PAT in $token
, and replace the OrgName
, ProjectName
, FeedID
, YourPackageName
, PackageVersion
with your own ones, you can set PreRelease/Release
in viewID to promote universal packages in Azure DevOps feed view from @local
to @pre-release
to @release
.
Test result: