From dd2e8a486fdc1071872c594d5388fd6dce1a7534 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Tue, 13 Aug 2019 16:32:09 -0400 Subject: [PATCH] Use node-version instead of version (#28) * Use node-version instead of version * Add deprecation date --- README.md | 8 ++++---- action.yml | 9 ++++++--- lib/setup-node.js | 5 ++++- src/setup-node.ts | 5 ++++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c426c2a9..9feb4812 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ steps: - uses: actions/checkout@master - uses: actions/setup-node@v1 with: - version: '10.x' + node-version: '10.x' - run: npm install - run: npm test ``` @@ -38,7 +38,7 @@ jobs: - name: Setup node uses: actions/setup-node@v1 with: - version: ${{ matrix.node }} + node-version: ${{ matrix.node }} - run: npm install - run: npm test ``` @@ -49,7 +49,7 @@ steps: - uses: actions/checkout@master - uses: actions/setup-node@v1 with: - version: '10.x' + node-version: '10.x' registry-url: 'https://registry.npmjs.org' - run: npm install - run: npm publish @@ -69,7 +69,7 @@ steps: - uses: actions/checkout@master - uses: actions/setup-node@v1 with: - version: '10.x' + node-version: '10.x' registry-url: - run: npm install -g yarn - run: yarn install diff --git a/action.yml b/action.yml index 2b9fb24d..49c9efe6 100644 --- a/action.yml +++ b/action.yml @@ -1,14 +1,17 @@ name: 'Setup Node.js environment' description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support' author: 'GitHub' -inputs: - version: - description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0, lts' +inputs: + node-version: + description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0' default: '10.x' 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' scope: 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: using: 'node12' main: 'lib/setup-node.js' diff --git a/lib/setup-node.js b/lib/setup-node.js index 974936f3..dc65699b 100644 --- a/lib/setup-node.js +++ b/lib/setup-node.js @@ -26,7 +26,10 @@ function run() { // Version is optional. If supplied, install / use from the tool cache // 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) { // TODO: installer doesn't support proxy yield installer.getNode(version); diff --git a/src/setup-node.ts b/src/setup-node.ts index ba64e247..f82413a0 100644 --- a/src/setup-node.ts +++ b/src/setup-node.ts @@ -9,7 +9,10 @@ async function run() { // Version is optional. If supplied, install / use from the tool cache // 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) { // TODO: installer doesn't support proxy await installer.getNode(version);