Creating Git-Tags for node apps in Azure DevOps

Bjego
Jan 26, 2023

Hey guys, maybe you also want to create git tags for your node based applications during your CI/CD pipeline.

First of all keep your package.json file updated and especially the version property. This means increment it before every release of your application.

Then in your pipeline simply add:

steps:
- checkout: self
persistCredentials: "true"
...
- pwsh: |
$version = Get-Content ./package.json | ConvertFrom-Json
& git tag "v$($version.version)"
& git push origin --tags

You may have to grant the build service to push tags to your repository:
StackOverflow.

I’ve granted the service account on top of all my repos, so that it can add tags in every repo.

--

--