diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 575604a..bbb7cc2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,7 +36,7 @@ jobs: run: | actual="$(pnpm --version)" echo "pnpm version: ${actual}" - if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then echo "ERROR: pnpm --version did not produce valid output" exit 1 fi @@ -81,7 +81,7 @@ jobs: run: | actual="$(pnpm --version)" echo "pnpm version: ${actual}" - if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then echo "ERROR: pnpm --version did not produce valid output" exit 1 fi @@ -115,7 +115,7 @@ jobs: run: | actual="$(pnpm --version)" echo "pnpm version: ${actual}" - if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then echo "ERROR: pnpm --version did not produce valid output" exit 1 fi @@ -220,7 +220,7 @@ jobs: run: | actual="$(pnpm --version)" echo "pnpm version: ${actual}" - if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then echo "ERROR: pnpm --version did not produce valid output" exit 1 fi diff --git a/dist/index.js b/dist/index.js index 5c8cd04..5d098bc 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/install-pnpm/run.ts b/src/install-pnpm/run.ts index f2f5e60..1a847af 100644 --- a/src/install-pnpm/run.ts +++ b/src/install-pnpm/run.ts @@ -40,12 +40,13 @@ export async function runSelfInstaller(inputs: Inputs): Promise { const pnpmHome = standalone && process.platform === 'win32' ? path.join(dest, 'node_modules', '@pnpm', 'exe') : path.join(dest, 'node_modules', '.bin') + // pnpm expects PNPM_HOME/bin in PATH for global binaries (e.g. node + // installed via `pnpm runtime`). Add it first so the next addPath + // (pnpmHome itself, which contains pnpm.exe) has higher precedence. + addPath(path.join(pnpmHome, 'bin')) addPath(pnpmHome) exportVariable('PNPM_HOME', pnpmHome) - // pnpm expects PNPM_HOME/bin in PATH for global binaries - addPath(path.join(pnpmHome, 'bin')) - // Ensure pnpm bin link exists — npm ci sometimes doesn't create it if (process.platform !== 'win32') { const pnpmBinLink = path.join(dest, 'node_modules', '.bin', 'pnpm')