https://github.com/volta-cli/action
GitHub Action to Setup Volta
https://github.com/volta-cli/action
hacktoberfest
Last synced: 12 months ago
JSON representation
GitHub Action to Setup Volta
- Host: GitHub
- URL: https://github.com/volta-cli/action
- Owner: volta-cli
- License: mit
- Created: 2019-10-16T21:07:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-29T13:57:02.000Z (over 1 year ago)
- Last Synced: 2024-10-14T14:06:45.489Z (over 1 year ago)
- Topics: hacktoberfest
- Language: TypeScript
- Homepage: https://volta.sh
- Size: 25.2 MB
- Stars: 91
- Watchers: 3
- Forks: 24
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action to Setup Volta
This action installs [volta](https://volta.sh) by:
- downloading and caching volta (adding it to your $PATH)
- optionally downloading and caching a version of node - npm by version spec and add to PATH
## Inputs
| name | description | required | default |
| --- | --- | --- | --- |
| `volta-version` |
Version of volta to fetch and setup. Examples: 0.6.0, 10.15.1, >=10.15.0
| `false` | `""` |
| `node-version` | Version Spec of the node version to use. Examples: 10.6.x, 10.15.1, >=10.15.0
| `false` | `""` |
| `npm-version` | Version Spec of the npm version to use. Examples: 7.5.x, 7.5.3, >=7.5.3
| `false` | `""` |
| `yarn-version` | Version Spec of the yarn version to use. Examples: 1.6.x, 10.15.1, >=10.15.0
| `false` | `""` |
| `package-json-path` | The path to the package.json to update when using an explicit node-version | yarn-version | npm-version override. By default, we will use package.json in the checkout root.
| `false` | `""` |
| `variant` | Specific variant to install. Example: providing the variant "linux-openssl-rhel", which will target installing the volta-${version}-linux-openssl-rhel.tar.gz tarball
| `false` | `""` |
| `registry-url` | Optional registry to set up for auth. Will set the registry in a project level .npmrc file, and set up auth to read in from env.NODEAUTHTOKEN
| `false` | `""` |
| `scope` | Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
| `false` | `""` |
| `token` | Used to avoid low rate limiting for cached tool downloads. Since there's a default, this is typically not supplied by the user.
| `false` | `${{ github.token }}` |
| `always-auth` | Set always-auth in npmrc
| `false` | `false` |
## Usage
See [action.yml](action.yml)
Basic (when the project's `package.json` has a `volta` property with `node` and/or `yarn` versions pinned):
```yaml
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
- run: npm install
- run: npm test
```
Manually specifying node and/or yarn versions (e.g. to test a project without `volta` in `package.json`):
```yaml
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
node-version: 18.x
yarn-version: 1.19.1
- run: yarn install
- run: yarn test
```
Setting up a matrix of node versions:
```yaml
strategy:
matrix:
node-version: ['^14.10', '16', '18']
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
```
You can also specify the version of npm:
```yaml
strategy:
matrix:
node-version: ['^8.12', '10', '12']
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
npm-version: '7'
- run: npm install
- run: npm test
```
In some cases, you may know the particular variant of the installer that you want to use for Volta. You can specify the `variant` input to the action to use a specific installer:
```yaml
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
variant: 'linux-openssl-rhel'
- run: yarn install
- run: yarn test
```
The `variant` fragment corresponds to a portion of the installer filename, and can be found in the [Volta Releases](https://github.com/volta-cli/volta/releases) page.
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)