Last active
June 2, 2023 06:26
-
-
Save svierk/f341d2d31df75b370b60b10cda4768f4 to your computer and use it in GitHub Desktop.
Sample GitHub Actions 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: | |
- name: Get node version from package.json | |
run: | | |
echo "$(cat ./package.json)" | jq .engines.node | xargs -I {} echo "nodeVersion="{} >> $GITHUB_ENV | |
- name: Use node version ${{ env.nodeVersion }} from package.json | |
uses: actions/setup-node@main | |
with: | |
node-version: ${{ env.nodeVersion }} | |
cache: 'npm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment