Skip to content

Commit 8de2f9f

Browse files
Danny McCormickDanny McCormick
authored andcommitted
Release from master
1 parent 5273d0d commit 8de2f9f

34 files changed

+371
-293
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# setup-node
22

3+
<p align="left">
4+
<a href="https://github.com/actions/setup-node"><img alt="GitHub Actions status" src="https://github.com/actions/setup-node/workflows/Main%20workflow/badge.svg"></a>
5+
</p>
6+
37
This action sets by node environment for use in actions by:
48

59
- optionally downloading and caching a version of node - npm by version spec and add to PATH
@@ -15,7 +19,7 @@ steps:
1519
- uses: actions/checkout@master
1620
- uses: actions/setup-node@v1
1721
with:
18-
version: '10.x'
22+
node-version: '10.x'
1923
- run: npm install
2024
- run: npm test
2125
```
@@ -34,7 +38,7 @@ jobs:
3438
- name: Setup node
3539
uses: actions/setup-node@v1
3640
with:
37-
version: ${{ matrix.node }}
41+
node-version: ${{ matrix.node }}
3842
- run: npm install
3943
- run: npm test
4044
```
@@ -45,7 +49,7 @@ steps:
4549
- uses: actions/checkout@master
4650
- uses: actions/setup-node@v1
4751
with:
48-
version: '10.x'
52+
node-version: '10.x'
4953
registry-url: 'https://registry.npmjs.org'
5054
- run: npm install
5155
- run: npm publish
@@ -65,7 +69,7 @@ steps:
6569
- uses: actions/checkout@master
6670
- uses: actions/setup-node@v1
6771
with:
68-
version: '10.x'
72+
node-version: '10.x'
6973
registry-url: <registry url>
7074
- run: npm install -g yarn
7175
- run: yarn install

__tests__/__snapshots__/authutil.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ registry=https://registry.npmjs.org/"
77

88
exports[`installer tests Automatically configures GPR scope 1`] = `
99
"npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}
10-
@owner:registry=npm.pkg.github.com/"
10+
@ownername:registry=npm.pkg.github.com/"
1111
`;
1212

1313
exports[`installer tests Configures scoped npm registries 1`] = `
1414
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
15-
@myScope:registry=https://registry.npmjs.org/"
15+
@myscope:registry=https://registry.npmjs.org/"
1616
`;
1717

1818
exports[`installer tests Sets up npmrc for npmjs 1`] = `

__tests__/authutil.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const tempDir = path.join(
1515

1616
const rcFile = path.join(tempDir, '.npmrc');
1717

18-
process.env['GITHUB_REPOSITORY'] = 'owner/repo';
18+
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
1919
process.env['RUNNER_TEMP'] = tempDir;
2020
import * as auth from '../src/authutil';
2121

action.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
name: 'Setup Node.js for use with actions'
1+
name: 'Setup Node.js environment'
22
description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support'
33
author: 'GitHub'
4-
inputs:
5-
version:
6-
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0, lts'
4+
inputs:
5+
node-version:
6+
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0'
77
default: '10.x'
88
registry-url:
99
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'
1010
scope:
1111
description: 'Optional scope for authenticating against scoped registries'
12+
# Deprecated option, do not use. Will not be supported after October 1, 2019
13+
version:
14+
description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019'
1215
runs:
1316
using: 'node12'
1417
main: 'lib/setup-node.js'

lib/authutil.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function writeRegistryToFile(registryUrl, fileLocation) {
2828
if (scope && scope[0] != '@') {
2929
scope = '@' + scope;
3030
}
31+
if (scope) {
32+
scope = scope.toLowerCase();
33+
}
3134
core.debug(`Setting auth in ${fileLocation}`);
3235
let newContents = '';
3336
if (fs.existsSync(fileLocation)) {

lib/installer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function queryLatestMatch(versionSpec) {
103103
}
104104
let versions = [];
105105
let dataUrl = 'https://nodejs.org/dist/index.json';
106-
let rest = new restm.RestClient('vsts-node-tool');
106+
let rest = new restm.RestClient('setup-node');
107107
let nodeVersions = (yield rest.get(dataUrl)).result || [];
108108
nodeVersions.forEach((nodeVersion) => {
109109
// ensure this version supports your os and platform

lib/setup-node.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ function run() {
2626
// Version is optional. If supplied, install / use from the tool cache
2727
// If not supplied then task is still used to setup proxy, auth, etc...
2828
//
29-
const version = core.getInput('version');
29+
let version = core.getInput('version');
30+
if (!version) {
31+
version = core.getInput('node-version');
32+
}
3033
if (version) {
3134
// TODO: installer doesn't support proxy
3235
yield installer.getNode(version);

node_modules/@actions/core/README.md

Lines changed: 75 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/core.d.ts

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/core.js

Lines changed: 25 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/package.json

Lines changed: 15 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/exec/LICENSE.md

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)