Skip to content

Commit

Permalink
Release from master
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny McCormick authored and Danny McCormick committed Aug 22, 2019
1 parent 5273d0d commit 8de2f9f
Show file tree
Hide file tree
Showing 34 changed files with 371 additions and 293 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# setup-node

<p align="left">
<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>
</p>

This action sets by node environment for use in actions by:

- optionally downloading and caching a version of node - npm by version spec and add to PATH
Expand All @@ -15,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
```
Expand All @@ -34,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
```
Expand All @@ -45,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
Expand All @@ -65,7 +69,7 @@ steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
version: '10.x'
node-version: '10.x'
registry-url: <registry url>
- run: npm install -g yarn
- run: yarn install
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__snapshots__/authutil.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ registry=https://registry.npmjs.org/"

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

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

exports[`installer tests Sets up npmrc for npmjs 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion __tests__/authutil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const tempDir = path.join(

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

process.env['GITHUB_REPOSITORY'] = 'owner/repo';
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
process.env['RUNNER_TEMP'] = tempDir;
import * as auth from '../src/authutil';

Expand Down
11 changes: 7 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: 'Setup Node.js for use with actions'
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'
3 changes: 3 additions & 0 deletions lib/authutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function writeRegistryToFile(registryUrl, fileLocation) {
if (scope && scope[0] != '@') {
scope = '@' + scope;
}
if (scope) {
scope = scope.toLowerCase();
}
core.debug(`Setting auth in ${fileLocation}`);
let newContents = '';
if (fs.existsSync(fileLocation)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function queryLatestMatch(versionSpec) {
}
let versions = [];
let dataUrl = 'https://nodejs.org/dist/index.json';
let rest = new restm.RestClient('vsts-node-tool');
let rest = new restm.RestClient('setup-node');
let nodeVersions = (yield rest.get(dataUrl)).result || [];
nodeVersions.forEach((nodeVersion) => {
// ensure this version supports your os and platform
Expand Down
5 changes: 4 additions & 1 deletion lib/setup-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
File renamed without changes.
76 changes: 75 additions & 1 deletion node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions node_modules/@actions/core/lib/core.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 25 additions & 9 deletions node_modules/@actions/core/lib/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/core.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 15 additions & 17 deletions node_modules/@actions/core/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions node_modules/@actions/exec/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8de2f9f

Please sign in to comment.