Skip to content

Instantly share code, notes, and snippets.

@shashank-shekhar
Created April 18, 2025 14:15
Show Gist options
  • Select an option

  • Save shashank-shekhar/845ddb4950d64bc867447c415240154c to your computer and use it in GitHub Desktop.

Select an option

Save shashank-shekhar/845ddb4950d64bc867447c415240154c to your computer and use it in GitHub Desktop.
Update version of node package
$SourcesDirectory = "/path/to/packa.json/directory/"
$BuildId = "1234" # This should be set to the actual build ID in your CI/CD pipeline
$packageJsonPath = "$(SourcesDirectory)/package.json"
$package = Get-Content $packageJsonPath | ConvertFrom-Json
$package.version = "0.1.$(BuildId)"
$package | ConvertTo-Json -Depth 100 | Set-Content $packageJsonPath -Encoding UTF8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment