Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/threeal/setup-yarn-action
Install Node.js dependencies using Yarn with cache support on GitHub Actions
https://github.com/threeal/setup-yarn-action
action actions github-actions javascript nodejs typescript yarn
Last synced: about 1 month ago
JSON representation
Install Node.js dependencies using Yarn with cache support on GitHub Actions
- Host: GitHub
- URL: https://github.com/threeal/setup-yarn-action
- Owner: threeal
- License: mit
- Created: 2023-12-04T08:35:01.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-20T16:31:35.000Z (9 months ago)
- Last Synced: 2024-02-20T17:33:45.206Z (9 months ago)
- Topics: action, actions, github-actions, javascript, nodejs, typescript, yarn
- Language: TypeScript
- Homepage:
- Size: 1.14 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Setup Yarn Berry Action
The Setup Yarn Berry Action is a [GitHub action](https://github.com/features/actions) designed to set up the [Yarn](https://yarnpkg.com/) package manager in the GitHub workflows of your [Node.js](https://nodejs.org/en) projects.
This action sets up Yarn to a specified version and installs dependencies for the current Node.js project with cache support.
Cache support provides fast setup for Node.js projects by using dependencies installed from previous runs.This action currently only supports the berry version of Yarn (Yarn 2+).
If your project still uses the classic version of Yarn, it is suggested to migrate to the berry version.
Refer to [this](https://yarnpkg.com/migration/overview) for the migration guide.## Key Features
The Setup Yarn Berry Action offers the following key features:
- Sets up Yarn to a specified version.
- Installs dependencies for the current Node.js project with cache support.## Available Inputs
Here are the available input parameters for the Setup Yarn Berry Action:
| Name | Type | Description |
| --------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `version` | String | Specifies the version of Yarn to set up using this action. The specified version can be a tag (e.g., `stable`), a semver range (e.g., `4.x`), or a semver version (e.g., `4.1.0`). If not specified, it uses the default Yarn version. |
| `cache` | Boolean | Indicates whether to enable caching during Yarn installation. It defaults to `true`. |## Example Usage
Here's a basic example demonstrating how to utilize the Setup Yarn Berry Action to set up the default version of Yarn and install dependencies for the current Node.js project in the GitHub workflow:
```yaml
name: Node.js CI
on:
push:
jobs:
build:
name: Build Project
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]- name: Setup Yarn
uses: threeal/[email protected]# Add more steps as needed for your workflow
```### Specifying Yarn Version
By default, this action will set up Yarn to the default version specified by the current Node.js project.
However, you can override it by specifying it in the `version` input parameter as shown below:```yaml
- name: Setup Latest Yarn
uses: threeal/[email protected]
with:
version: latest
```Refer to [this](https://yarnpkg.com/cli/set/version) for more information on the available versions that can be set up by this action.
### Disabling Caching
By default, caching is always enabled when installing dependencies of the current Node.js project.
To disable it, set the `cache` input parameter to `false` as shown below:```yaml
- name: Setup Yarn Without Caching
uses: threeal/[email protected]
with:
cache: false
```## License
This project is licensed under the terms of the [MIT License](./LICENSE).
Copyright © 2023-2024 [Alfi Maulana](https://github.com/threeal/)