mirror of
https://github.com/pnpm/action-setup.git
synced 2026-05-10 01:49:58 +00:00
fix: bin_dest output points to self-updated pnpm, not bootstrap (#247)
`pnpm self-update <version>` writes the target binary to
`${PNPM_HOME}/bin/`, leaving the bootstrap symlink at `${PNPM_HOME}/pnpm`
untouched. The `bin_dest` output was set to `${PNPM_HOME}`, so consumers
invoking `${{ steps.pnpm.outputs.bin_dest }}/pnpm` got the bootstrap
version (currently 11.0.4) instead of the version they requested.
PATH lookup hid the bug: `${PNPM_HOME}/bin` was prepended ahead of
`${PNPM_HOME}`, so `pnpm` resolved from PATH was the right one. Existing
version-respect tests only checked `pnpm --version`, not `bin_dest`.
Resolve `binDest` inside `runSelfInstaller` (target lives in
`${PNPM_HOME}/bin` after self-update, otherwise stays at `${PNPM_HOME}`)
and plumb it through to `setOutputs`. Add a regression test that invokes
`${bin_dest}/pnpm --version` directly across Linux/macOS/Windows.
This commit is contained in:
39
.github/workflows/test.yaml
vendored
39
.github/workflows/test.yaml
vendored
@@ -166,6 +166,45 @@ jobs:
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test_bin_dest_output:
|
||||
name: 'Test bin_dest output points to requested version (${{ matrix.version }}, ${{ matrix.os }})'
|
||||
# Regression test for #247: invoking pnpm via the `bin_dest` output returned the
|
||||
# bootstrap version because self-update writes the target to `${bin_dest}/bin/`,
|
||||
# not directly into `${bin_dest}/`.
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
version:
|
||||
- '9.15.5'
|
||||
- '10.33.2'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
|
||||
- id: pnpm
|
||||
name: Run the action
|
||||
uses: ./
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
|
||||
- name: 'Test: bin_dest/pnpm reports requested version'
|
||||
run: |
|
||||
required='${{ matrix.version }}'
|
||||
actual="$(${{ steps.pnpm.outputs.bin_dest }}/pnpm --version)"
|
||||
echo "pnpm version via bin_dest: ${actual}"
|
||||
if [ "${actual}" != "${required}" ]; then
|
||||
echo "Expected pnpm version ${required}, but got ${actual}"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test_package_manager_field:
|
||||
name: 'Test packageManager field is respected (${{ matrix.version }}, ${{ matrix.os }})'
|
||||
# Reproduces #227: when `packageManager` is set in package.json and no `version:` input is given,
|
||||
|
||||
Reference in New Issue
Block a user