Skip to content

Commit

Permalink
feat(workflows): detect pnpm and node versions to use
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschuerch committed Jul 8, 2024
1 parent 3e4f960 commit ef489b5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/actions/setup-pnpm/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,29 @@ runs:
return {
node: pkg.engines?.node,
pnpm: pkg.engines?.pnpm
pnpm: pkg.packageManager
}
- name: Install pnpm
uses: pnpm/action-setup@v4
# if: fromJSON(steps.wanted-versions.outputs.result).packageManager == false
with:
version: ${{ inputs.pnpm_version || fromJSON(steps.wanted-versions.outputs.result).pnpm }}
# If input.pnpm_version is NOT defined,
# the action automatically uses the "packageManager" field from the package.json file
# If input.pnpm_version is defined, we need to point to another package.json file, without the "packageManager" field,
# so we do not end up with a "Multiple versions of pnpm specified" error
package_json_file: ${{ inputs.pnpm_version && 'packages/documentation/package.json' || 'package.json' }}
version: ${{ inputs.pnpm_version || null }}

- name: Install node with pnpm cache
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version || fromJSON(steps.wanted-versions.outputs.result).node }}
cache: ${{ inputs.use_cache == 'true' && 'pnpm' || '' }}

- name: Summary
shell: bash
run: |
echo "Installed versions:"
echo "- node: ${{ inputs.node_version || fromJSON(steps.wanted-versions.outputs.result).node }}"
echo "- pnpm: ${{ inputs.pnpm_version || fromJSON(steps.wanted-versions.outputs.result).pnpm }}"

0 comments on commit ef489b5

Please sign in to comment.