Skip to content

Instantly share code, notes, and snippets.

@svierk
Last active June 1, 2023 15:27
Show Gist options
  • Save svierk/0d86f828ce474a127129f68e31bcb6f1 to your computer and use it in GitHub Desktop.
Save svierk/0d86f828ce474a127129f68e31bcb6f1 to your computer and use it in GitHub Desktop.
Sample Azure pipelines template for extracting the node version from the package.json's engine setting
steps:
- bash: |
set -euo pipefail
version=$( jq --raw-output '.engines.node' ./package.json)
echo "##vso[task.setvariable variable=nodeVersion;isOutput=true]$version"
displayName: Get node version from package.json
name: getNode
- task: NodeTool@0
displayName: Use node version from package.json
retryCountOnTaskFailure: 1
inputs:
versionSpec: $(getNode.nodeVersion)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment