Skip to content

Commit

Permalink
feat(yarn2): add yarn 2 install action
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Aug 11, 2022
1 parent a45e6f0 commit d938245
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This is a collection of reusable composite actions for GitHub Actions workflows.
- [npm-install](#npm-install)
- [setup-node](#setup-node)
- [yarn-install](#yarn-install)
- [yarn2-install](#yarn2-install)
- [PHP](#php)
- [composer-install](#composer-install)
- [Testing](#testing)
Expand Down Expand Up @@ -83,6 +84,8 @@ Will use every patch update within `v2.1.x`.

#### yarn-install

For use with Yarn 1.

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

1. Runs [actions/setup-node]
Expand All @@ -97,6 +100,25 @@ Will use every patch update within `v2.1.x`.
node-version: 16
```

#### yarn2-install

For use with Yarn 2 (berry).

[Source](yarn2-install/action.yml)

1. Runs [actions/setup-node]
2. Handles yarn cache
3. Runs `yarn install`. Because this runs on CI, [`--immutable` will be used by
default](https://yarnpkg.com/cli/install).

##### Example

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

#### pnpm-install

[Source](pnpm-install/action.yml)
Expand Down Expand Up @@ -393,13 +415,23 @@ jobs:
```

[Codecov]: https://codecov.io

[actions/checkout]: https://github.com/actions/checkout

[actions/setup-node]: https://github.com/actions/setup-node

[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
31 changes: 31 additions & 0 deletions yarn2-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Install yarn 2 dependencies
description: Install yarn 2 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/setup-node@v3
with:
node-version: ${{ inputs.node-version }}

- name: 'Get yarn cache directory path'
id: yarn-cache-dir-path
shell: bash
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: 'Install yarn dependencies'
run: yarn install
shell: bash

0 comments on commit d938245

Please sign in to comment.