Adding tool binaries to PATH
This commit is contained in:
parent
9b492bbd34
commit
5e422a4552
2 changed files with 21 additions and 1 deletions
11
lib/run.js
11
lib/run.js
|
@ -1,9 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -74,6 +75,14 @@ function run() {
|
||||||
version = yield getStableKubectlVersion();
|
version = yield getStableKubectlVersion();
|
||||||
}
|
}
|
||||||
let cachedPath = yield downloadKubectl(version);
|
let cachedPath = yield downloadKubectl(version);
|
||||||
|
try {
|
||||||
|
if (!process.env['PATH'].startsWith(path.dirname(cachedPath))) {
|
||||||
|
core.addPath(path.dirname(cachedPath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
//do nothing, set as output variable
|
||||||
|
}
|
||||||
console.log(`Kubectl tool version: '${version}' has been cached at ${cachedPath}`);
|
console.log(`Kubectl tool version: '${version}' has been cached at ${cachedPath}`);
|
||||||
core.setOutput('kubectl-path', cachedPath);
|
core.setOutput('kubectl-path', cachedPath);
|
||||||
});
|
});
|
||||||
|
|
11
src/run.ts
11
src/run.ts
|
@ -70,6 +70,17 @@ async function run() {
|
||||||
version = await getStableKubectlVersion();
|
version = await getStableKubectlVersion();
|
||||||
}
|
}
|
||||||
let cachedPath = await downloadKubectl(version);
|
let cachedPath = await downloadKubectl(version);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (!process.env['PATH'].startsWith(path.dirname(cachedPath))) {
|
||||||
|
core.addPath(path.dirname(cachedPath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
//do nothing, set as output variable
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Kubectl tool version: '${version}' has been cached at ${cachedPath}`);
|
console.log(`Kubectl tool version: '${version}' has been cached at ${cachedPath}`);
|
||||||
core.setOutput('kubectl-path', cachedPath);
|
core.setOutput('kubectl-path', cachedPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue