Skip to content

Commit

Permalink
feat(npm): add pnpm install action
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jun 15, 2022
1 parent 5d85fd6 commit fd9c1a2
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 14 deletions.
46 changes: 32 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,36 +75,53 @@ Will use every patch update within `v2.1.x`.
node-version: 16
```

### setup-node

> ⚠️ Deprecated: use actions/setup-node@v3 instead.
### yarn-install

[Source](setup-node/action.yml)
[Source](yarn-install/action.yml)

1. Sets up node@14
- You can change the version by passing `node-version`.
1. Runs [actions/setup-node]
2. Handles `node_modules` cache
3. Runs `yarn install --frozen-lockfile`

#### Example

```yaml
- name:
uses: myparcelnl/actions/setup-node@v2
- uses: myparcelnl/actions/yarn-install@v2
with:
node-version: 16
```

### yarn-install
### pnpm-install

[Source](yarn-install/action.yml)
[Source](pnpm-install/action.yml)

1. Runs [actions/setup-node]
2. Handles `node_modules` cache
3. Runs `yarn install --frozen-lockfile`
2. Installs pnpm
4. Handles pnpm cache
5. Runs `pnpm install --frozen-lockfile`

#### Example

```yaml
- uses: myparcelnl/actions/yarn-install@v2
- uses: myparcelnl/actions/pnpm-install@v2
with:
node-version: 16
```

### ~~setup-node~~

> ⚠️ Deprecated: use actions/setup-node@v3 instead.
[Source](setup-node/action.yml)

1. Sets up node@14
- You can change the version by passing `node-version`.

#### Example

```yaml
- name:
uses: myparcelnl/actions/setup-node@v2
with:
node-version: 16
```
Expand Down Expand Up @@ -329,10 +346,11 @@ If run without `minor: true`, or with `minor: false`:

[Codecov]: https://codecov.io
[actions/setup-node]: https://github.com/actions/setup-node
[build-docker-image]: #build-docker-image
[build-docker-image-reg]: #build-docker-image-reg
[build-docker-image]: #build-docker-image
[codecov/codecov-action]: https://github.com/codecov/codecov-action
[composer-install]: #composer-install
[npm-install]: #npm-install
[pnpm-install]: #pnpm-install
[semantic-release]: #semantic-release
[yarn-install]: #yarn-install
40 changes: 40 additions & 0 deletions pnpm-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Install pnpm dependencies'
description: 'Install pnpm dependencies from scratch or from cache'

inputs:
node-version:
description: 'The Node.js version to use'
default: '16'
required: false

runs:
using: composite
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}

- uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: false

- name: 'Get pnpm store directory'
id: pnpm-cache
shell: bash
run: |
echo "::set-output name=dir::$(pnpm store path)"
- name: 'Prepare pnpm cache'
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 'Install pnpm dependencies'
shell: bash
run: pnpm install --frozen-lockfile

0 comments on commit fd9c1a2

Please sign in to comment.