Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set node-version output #173

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Expand Up @@ -23,6 +23,9 @@ inputs:
version:
description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019'
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use node-version instead'
outputs:
node-version:
description: "The installed node version."
runs:
using: 'node12'
main: 'dist/index.js'
11 changes: 11 additions & 0 deletions dist/index.js
Expand Up @@ -4628,6 +4628,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const exec = __importStar(__webpack_require__(986));
const installer = __importStar(__webpack_require__(749));
const auth = __importStar(__webpack_require__(202));
const path = __importStar(__webpack_require__(622));
Expand All @@ -4650,6 +4651,16 @@ function run() {
const checkLatest = (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
yield installer.getNode(version, stable, checkLatest, auth);
}
// Output version of node is being used
let installedVersion = '';
yield exec.exec('node', ['--version'], {
listeners: {
stdout: data => {
installedVersion += data.toString();
}
}
});
core.setOutput('node-version', installedVersion);
const registryUrl = core.getInput('registry-url');
const alwaysAuth = core.getInput('always-auth');
if (registryUrl) {
Expand Down
12 changes: 12 additions & 0 deletions src/main.ts
@@ -1,4 +1,5 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as installer from './installer';
import * as auth from './authutil';
import * as path from 'path';
Expand All @@ -24,6 +25,17 @@ export async function run() {
await installer.getNode(version, stable, checkLatest, auth);
}

// Output version of node is being used
let installedVersion = '';
await exec.exec('node', ['--version'], {
listeners: {
stdout: data => {
installedVersion += data.toString();
}
}
});
core.setOutput('node-version', installedVersion);

const registryUrl: string = core.getInput('registry-url');
const alwaysAuth: string = core.getInput('always-auth');
if (registryUrl) {
Expand Down