Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lankaapura/45506efd8a378f8d32a9a7de6e5efd29 to your computer and use it in GitHub Desktop.
Save lankaapura/45506efd8a378f8d32a9a7de6e5efd29 to your computer and use it in GitHub Desktop.
Powershell script to parse a package.json version and use as the build number in TeamCity
$version = (Get-Content package.json) -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"
$buildCounter = "%build.counter%"
$buildNumber = "$version.$buildCounter"
Write-Host "##teamcity[buildNumber '$buildNumber']"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment