Use node-version instead of version (#28)

* Use node-version instead of version

* Add deprecation date
This commit is contained in:
Danny McCormick 2019-08-13 16:32:09 -04:00 committed by GitHub
parent d963e800e3
commit dd2e8a486f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 9 deletions

View file

@ -19,7 +19,7 @@ steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
version: '10.x' node-version: '10.x'
- run: npm install - run: npm install
- run: npm test - run: npm test
``` ```
@ -38,7 +38,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
version: ${{ matrix.node }} node-version: ${{ matrix.node }}
- run: npm install - run: npm install
- run: npm test - run: npm test
``` ```
@ -49,7 +49,7 @@ steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
version: '10.x' node-version: '10.x'
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- run: npm install - run: npm install
- run: npm publish - run: npm publish
@ -69,7 +69,7 @@ steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
version: '10.x' node-version: '10.x'
registry-url: <registry url> registry-url: <registry url>
- run: npm install -g yarn - run: npm install -g yarn
- run: yarn install - run: yarn install

View file

@ -1,14 +1,17 @@
name: 'Setup Node.js environment' name: 'Setup Node.js environment'
description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support' description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support'
author: 'GitHub' author: 'GitHub'
inputs: inputs:
version: node-version:
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0, lts' description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0'
default: '10.x' default: '10.x'
registry-url: registry-url:
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN' description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN'
scope: scope:
description: 'Optional scope for authenticating against scoped registries' description: 'Optional scope for authenticating against scoped registries'
# Deprecated option, do not use. Will not be supported after October 1, 2019
version:
description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019'
runs: runs:
using: 'node12' using: 'node12'
main: 'lib/setup-node.js' main: 'lib/setup-node.js'

View file

@ -26,7 +26,10 @@ function run() {
// Version is optional. If supplied, install / use from the tool cache // Version is optional. If supplied, install / use from the tool cache
// If not supplied then task is still used to setup proxy, auth, etc... // If not supplied then task is still used to setup proxy, auth, etc...
// //
const version = core.getInput('version'); let version = core.getInput('version');
if (!version) {
version = core.getInput('node-version');
}
if (version) { if (version) {
// TODO: installer doesn't support proxy // TODO: installer doesn't support proxy
yield installer.getNode(version); yield installer.getNode(version);

View file

@ -9,7 +9,10 @@ async function run() {
// Version is optional. If supplied, install / use from the tool cache // Version is optional. If supplied, install / use from the tool cache
// If not supplied then task is still used to setup proxy, auth, etc... // If not supplied then task is still used to setup proxy, auth, etc...
// //
const version = core.getInput('version'); let version = core.getInput('version');
if (!version) {
version = core.getInput('node-version');
}
if (version) { if (version) {
// TODO: installer doesn't support proxy // TODO: installer doesn't support proxy
await installer.getNode(version); await installer.getNode(version);