You can not use git tag or package.json version for release name directly, since only part of predefined variables can be used for release name, and variables can not persist between build and release.
But you can use group variable for assistance: update group variable value with git tag or package.json version at the end of your CI build, and use the group variable as the release name. Detail steps as below:
Add variable group
In Build and Release Hub -> Library Tab -> Add Variable group (such as release name
) with a variable (such as tag
) with any initial value (such as 0
).

Change the group variable in CI build
You can add a PowerShell task to change the group variable with git tag or package.json version.
- To get the tag name, you can use the git command
git tag --points-at HEAD
.
- To get the package.json version, you can use powershell script to search the line start with
"version"
etc.
- To update the group variable, you should use the REST API Variablegroups - Update.
Use the group variable in release
To apply the git tag or package.json version in release name, you can change your release definition as below:
Release definition -> Variables Tab -> Variable groups -> Link variable group -> select the variable group -> Options Tab -> specify the group variable tag with revision as the release name.

Now when the release is triggered, it will use the git tag or package.json version with revision for the release name.