Skip to content

Commit

Permalink
feat: add node version as input
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode authored and jsmrcaga committed Nov 10, 2021
1 parent aeb6aa5 commit 97d9759
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -41,6 +41,7 @@ The inputs this action uses are:
| `install_command` | `false` | Auto-detected | The (optional) command to install dependencies. Runs `yarn` when `yarn.lock` is found; `npm i` otherwise |
| `build_command` | `false` | `npm run build` | The (optional) command to build static website |
| `deploy_alias` | `false` | '' | (Optional) [Deployed site alias](https://cli.netlify.com/commands/deploy) |
| `node_version` | `false` | '' | (Optional) Node version or other arguments passed to [nvm install](https://github.com/nvm-sh/nvm#usage) |

## Example

Expand Down Expand Up @@ -137,6 +138,8 @@ jobs:

### Selecting node version

By default, the latest node will be installed before buidling the application.
By default, the latest node will be installed before building the application.

To select a different release, create an `.nvmrc` file with the desired version range.
Use the `node_version` input to change the desired version. It will be passed to [`nvm install`](https://github.com/nvm-sh/nvm#usage). Valid examples include `16.3.0`, `14`, or `--lts`.

Alternatively, create an `.nvmrc` file with the desired version range in your repository.
8 changes: 7 additions & 1 deletion action.yml
Expand Up @@ -42,12 +42,17 @@ inputs:
description: 'Command to build static website'
required: false
default: 'npm run build'

deploy_alias:
description: 'Deployment Subdomain name'
required: false
default: ''

node_version:
description: 'Node version or arguments compatible with `nvm install`'
required: false
default: ''

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -60,6 +65,7 @@ runs:
- ${{ inputs.install_command }}
- ${{ inputs.build_command }}
- ${{ inputs.deploy_alias }}
- ${{ inputs.node_version }}

branding:
icon: activity
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Expand Up @@ -10,7 +10,7 @@ NETLIFY_CLI=$(which netlify)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"

nvm install
nvm install "$9"

NETLIFY_AUTH_TOKEN=$1
NETLIFY_SITE_ID=$2
Expand Down

0 comments on commit 97d9759

Please sign in to comment.