mirror of
https://github.com/pnpm/action-setup.git
synced 2025-07-08 22:59:22 +08:00
Compare commits
8 Commits
v4.0.0
...
remove-v2-
Author | SHA1 | Date | |
---|---|---|---|
4b568c8023 | |||
18ac635edf | |||
0d0b43217a | |||
0eb0e97082 | |||
23657c8550 | |||
5d79380f29 | |||
562dbbf611 | |||
00884bcdc5 |
41
README.md
41
README.md
@ -60,7 +60,9 @@ Location of `pnpm` and `pnpx` command.
|
||||
|
||||
## Usage example
|
||||
|
||||
### Just install pnpm
|
||||
### Install only pnpm without `packageManager`
|
||||
|
||||
This works when the repo either doesn't have a `package.json` or has a `package.json` but it doesn't specify `packageManager`.
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@ -77,6 +79,23 @@ jobs:
|
||||
version: 8
|
||||
```
|
||||
|
||||
### Install only pnpm with `packageManager`
|
||||
|
||||
Omit `version` input to use the version in the [`packageManager` field in the `package.json`](https://nodejs.org/api/corepack.html).
|
||||
|
||||
```yaml
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v4
|
||||
```
|
||||
|
||||
### Install pnpm and a few npm packages
|
||||
|
||||
```yaml
|
||||
@ -115,29 +134,17 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
node-version: 20
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
@ -23,6 +23,11 @@ inputs:
|
||||
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js.
|
||||
required: false
|
||||
default: 'false'
|
||||
outputs:
|
||||
dest:
|
||||
description: Expanded path of inputs#dest
|
||||
bin_dest:
|
||||
description: Location of `pnpm` and `pnpx` command
|
||||
runs:
|
||||
using: node20
|
||||
main: dist/index.js
|
||||
|
@ -72,7 +72,7 @@ Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_
|
||||
|
||||
if (!GITHUB_WORKSPACE) {
|
||||
throw new Error(`No workspace is found.
|
||||
If you're intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,
|
||||
If you've intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,
|
||||
please run the actions/checkout before pnpm/action-setup.
|
||||
Otherwise, please specify the pnpm version in the action configuration.`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user