Last active
June 1, 2023 15:27
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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