Download from Azul if no Jdk file specified (#5)
* Download from zulu * Fix pathing * Fix * Fix * Fix * Update io * Tests and pathing * Add back husky * Update action.yml
This commit is contained in:
parent
012e07621e
commit
0cf3ae56f5
|
@ -51,7 +51,7 @@ describe('installer tests', () => {
|
|||
}
|
||||
}, 100000);
|
||||
|
||||
it('Acquires version of Java if no matching version is installed', async () => {
|
||||
it('Installs version of Java from jdkFile if no matching version is installed', async () => {
|
||||
await installer.getJava('12', 'x64', javaFilePath);
|
||||
const JavaDir = path.join(toolDir, 'Java', '12.0.0', 'x64');
|
||||
|
||||
|
@ -69,6 +69,24 @@ describe('installer tests', () => {
|
|||
expect(thrown).toBe(true);
|
||||
});
|
||||
|
||||
it('Downloads java if no file given', async () => {
|
||||
await installer.getJava('8.0.102', 'x64', '');
|
||||
const JavaDir = path.join(toolDir, 'Java', '8.0.102', 'x64');
|
||||
|
||||
expect(fs.existsSync(`${JavaDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(JavaDir, 'bin'))).toBe(true);
|
||||
}, 100000);
|
||||
|
||||
it('Throws if invalid directory to jdk', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await installer.getJava('1000', 'x64', 'bad path');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
|
||||
it('Uses version of Java installed in cache', async () => {
|
||||
const JavaDir: string = path.join(toolDir, 'Java', '250.0.0', 'x64');
|
||||
await io.mkdirP(JavaDir);
|
||||
|
|
|
@ -3,7 +3,7 @@ description: 'Setup your runner with Java'
|
|||
author: 'GitHub'
|
||||
inputs:
|
||||
version:
|
||||
description: 'A number that specifies the JDK version to make available on the path. Use a whole number version, such as 10'
|
||||
description: 'The JDK version to make available on the path. Use a whole version, such as 9.0.4'
|
||||
required: true
|
||||
architecture:
|
||||
description: 'The architecture (x86, x64) of the JDK.'
|
||||
|
|
|
@ -22,6 +22,7 @@ const exec = __importStar(require("@actions/exec"));
|
|||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const httpm = __importStar(require("typed-rest-client/HttpClient"));
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
|
@ -46,15 +47,20 @@ function getJava(version, arch, jdkFile) {
|
|||
core.debug(`Tool found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
let compressedFileExtension = '';
|
||||
if (!jdkFile) {
|
||||
throw new Error(`Failed to find Java ${version} in the cache. Please specify a valid jdk file to install from instead.`);
|
||||
core.debug('Downloading Jdk from Azul');
|
||||
jdkFile = yield downloadJava(version);
|
||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||
}
|
||||
else {
|
||||
core.debug('Retrieving Jdk from local path');
|
||||
const compressedFileExtension = getFileEnding(jdkFile);
|
||||
}
|
||||
compressedFileExtension = compressedFileExtension || getFileEnding(jdkFile);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const jdkDir = yield unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
|
||||
core.debug(`jdk extracted to ${jdkDir}`);
|
||||
toolPath = yield tc.cacheDir(jdkDir, 'Java', `${version}.0.0`, arch);
|
||||
toolPath = yield tc.cacheDir(jdkDir, 'Java', normalizeVersion(version), arch);
|
||||
}
|
||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||
core.exportVariable('JAVA_HOME', toolPath);
|
||||
|
@ -63,6 +69,13 @@ function getJava(version, arch, jdkFile) {
|
|||
});
|
||||
}
|
||||
exports.getJava = getJava;
|
||||
function normalizeVersion(version) {
|
||||
const versionArray = version.split('.');
|
||||
const major = versionArray[0];
|
||||
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
||||
const patch = versionArray.length > 2 ? versionArray[2] : '0';
|
||||
return `${major}.${minor}.${patch}`;
|
||||
}
|
||||
function getFileEnding(file) {
|
||||
let fileEnding = '';
|
||||
if (file.endsWith('.tar')) {
|
||||
|
@ -126,7 +139,7 @@ function unpackJars(fsPath, javaBinPath) {
|
|||
}
|
||||
});
|
||||
}
|
||||
function unzipJavaDownload(repoRoot, fileEnding, destinationFolder) {
|
||||
function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Create the destination folder if it doesn't exist
|
||||
yield io.mkdirP(destinationFolder);
|
||||
|
@ -143,3 +156,32 @@ function unzipJavaDownload(repoRoot, fileEnding, destinationFolder) {
|
|||
}
|
||||
});
|
||||
}
|
||||
function downloadJava(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let filterString = '';
|
||||
if (IS_WINDOWS) {
|
||||
filterString = `jdk${version}-win_x64.zip`;
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
filterString = `jdk${version}-macosx_x64.tar.gz`;
|
||||
}
|
||||
else {
|
||||
filterString = `jdk${version}-linux_x64.tar.gz`;
|
||||
}
|
||||
}
|
||||
let http = new httpm.HttpClient('setup-java');
|
||||
let contents = yield (yield http.get('https://static.azul.com/zulu/bin/')).readBody();
|
||||
let refs = contents.match(/<a href.*\">/gi) || [];
|
||||
refs = refs.filter(val => {
|
||||
if (val.indexOf(filterString) > -1) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (refs.length == 0) {
|
||||
throw new Error(`No valid download found for version ${version}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`);
|
||||
}
|
||||
const fileName = refs[0].slice('<a href="'.length, refs[0].length - '">'.length);
|
||||
return yield tc.downloadTool(`https://static.azul.com/zulu/bin/${fileName}`);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,6 +5,23 @@ export interface InputOptions {
|
|||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1,
|
||||
/**
|
||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||
*/
|
||||
Neutral = 78
|
||||
}
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
|
@ -30,6 +47,13 @@ export declare function addPath(inputPath: string): void;
|
|||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
*/
|
||||
export declare function setOutput(name: string, value: string): void;
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exit_1 = require("@actions/exit");
|
||||
const command_1 = require("./command");
|
||||
const path = require("path");
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
/**
|
||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||
*/
|
||||
ExitCode[ExitCode["Neutral"] = 78] = "Neutral";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -50,6 +67,16 @@ function getInput(name, options) {
|
|||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
*/
|
||||
function setOutput(name, value) {
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -57,7 +84,7 @@ exports.getInput = getInput;
|
|||
* Sets the action status to neutral
|
||||
*/
|
||||
function setNeutral() {
|
||||
process.exitCode = exit_1.ExitCode.Neutral;
|
||||
process.exitCode = ExitCode.Neutral;
|
||||
}
|
||||
exports.setNeutral = setNeutral;
|
||||
/**
|
||||
|
@ -66,7 +93,7 @@ exports.setNeutral = setNeutral;
|
|||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = exit_1.ExitCode.Failure;
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,wCAAsC;AACtC,uCAA6C;AAE7C,6BAA4B;AAU5B,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACzB,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAHD,oCAGC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,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"file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"_id": "@actions/core@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-58ituSV1rzBMmmsWoFDnrnsT+Wm4kD/u9NgAGbPvZ7rQHWluYtD5bDbIsjDC6rKFuhqytkxDJPsF/TWBdgc/nA==",
|
||||
"_integrity": "sha512-aA3W5QTRIbaRxEDo/Pn/unVB+PB6Vbyx2QNjnV35QRDsdhbMd65e3Gige0NCkjoJ3P+P1Fv5B9jb7XV78yUBIQ==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"raw": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-core-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-core-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-core-0.0.0.tgz",
|
||||
"_shasum": "346d90a534fa6c5021bc2e1b732574fd2c66fc35",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-core-0.0.0.tgz",
|
||||
"_shasum": "5c7a8cdd3b464dedd87d453965943c15aad1dd9a",
|
||||
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/exit": "^0.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
"_from": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_id": "@actions/exec@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A==",
|
||||
"_integrity": "sha512-Ha//34XKSv82P6QaaLwNK9cUJA2qzqPxRm1Cv0Wgj3k1ppS9MPjuCKQGvZI0CsbEs3UFq+NPorcbiAKM8smJWw==",
|
||||
"_location": "/@actions/exec",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"raw": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exec-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-exec-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_shasum": "85d7bb181b39e3d8861a91c4f07cb09842efc3e4",
|
||||
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,7 +0,0 @@
|
|||
# `@actions/exit`
|
||||
|
||||
> TODO: description
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/exit.ts](src/exit.ts).
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1,
|
||||
/**
|
||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||
*/
|
||||
Neutral = 78
|
||||
}
|
||||
/**
|
||||
* Exit the action as a success.
|
||||
*/
|
||||
export declare function success(): void;
|
||||
/**
|
||||
* Exit the action as a failure.
|
||||
*/
|
||||
export declare function failure(): void;
|
||||
/**
|
||||
* Exit the action neither a success or a failure
|
||||
*/
|
||||
export declare function neutral(): void;
|
|
@ -1,44 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
/**
|
||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||
*/
|
||||
ExitCode[ExitCode["Neutral"] = 78] = "Neutral";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
// TODO: These exit codes may not behave as expected on the new runtime, due to
|
||||
// complexities of async logging and sync exiting.
|
||||
/**
|
||||
* Exit the action as a success.
|
||||
*/
|
||||
function success() {
|
||||
process.exit(ExitCode.Success);
|
||||
}
|
||||
exports.success = success;
|
||||
/**
|
||||
* Exit the action as a failure.
|
||||
*/
|
||||
function failure() {
|
||||
process.exit(ExitCode.Failure);
|
||||
}
|
||||
exports.failure = failure;
|
||||
/**
|
||||
* Exit the action neither a success or a failure
|
||||
*/
|
||||
function neutral() {
|
||||
process.exit(ExitCode.Neutral);
|
||||
}
|
||||
exports.neutral = neutral;
|
||||
//# sourceMappingURL=exit.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../src/exit.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,8CAAY,CAAA;AACd,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB;AAED,+EAA+E;AAC/E,kDAAkD;AAElD;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAFD,0BAEC"}
|
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-exit-0.0.0.tgz",
|
||||
"_id": "@actions/exit@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vQdxFWM0/AERkC79mQ886SqPmV4joWhrSF7hiSTiJoKkE9eTjrKV5WQtp7SXv6OntrQkKX+ZjgdGpv+0rvJRCw==",
|
||||
"_location": "/@actions/exit",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"raw": "@actions/exit@file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"name": "@actions/exit",
|
||||
"escapedName": "@actions%2fexit",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exit-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exit-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/core"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exit-0.0.0.tgz",
|
||||
"_shasum": "d47c8c61b45750ae49fea3061e3419a547b2a48f",
|
||||
"_spec": "@actions/exit@file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Functions for safely exiting from GitHub Actions",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exit",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"toolkit"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/exit.js",
|
||||
"name": "@actions/exit",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare const copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, unlink: typeof fs.promises.unlink;
|
||||
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
||||
export declare const IS_WINDOWS: boolean;
|
||||
export declare function exists(fsPath: string): Promise<boolean>;
|
||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||
|
|
|
@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const assert_1 = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
_a = fs.promises, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.unlink = _a.unlink;
|
||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
function exists(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAQE,iMAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,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,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
|
@ -7,8 +7,16 @@ export interface CopyOptions {
|
|||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface MoveOptions {
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
|
@ -20,9 +28,9 @@ export declare function cp(source: string, dest: string, options?: CopyOptions):
|
|||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
export declare function mv(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
|
|
|
@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const childProcess = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const util_1 = require("util");
|
||||
const ioUtil = require("./io-util");
|
||||
const exec = util_1.promisify(childProcess.exec);
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
|
@ -23,7 +23,35 @@ const exec = util_1.promisify(childProcess.exec);
|
|||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: false });
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||
// Dest is an existing file, but not forcing
|
||||
if (destStat && destStat.isFile() && !force) {
|
||||
return;
|
||||
}
|
||||
// If dest is an existing directory, should copy inside.
|
||||
const newDest = destStat && destStat.isDirectory()
|
||||
? path.join(dest, path.basename(source))
|
||||
: dest;
|
||||
if (!(yield ioUtil.exists(source))) {
|
||||
throw new Error(`no such file or directory: ${source}`);
|
||||
}
|
||||
const sourceStat = yield ioUtil.stat(source);
|
||||
if (sourceStat.isDirectory()) {
|
||||
if (!recursive) {
|
||||
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
||||
}
|
||||
else {
|
||||
yield cpDirRecursive(source, newDest, 0, force);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (path.relative(source, newDest) === '') {
|
||||
// a file cannot be copied to itself
|
||||
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
||||
}
|
||||
yield copyFile(source, newDest, force);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.cp = cp;
|
||||
|
@ -32,11 +60,28 @@ exports.cp = cp;
|
|||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
function mv(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: true });
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
let destExists = true;
|
||||
if (yield ioUtil.isDirectory(dest)) {
|
||||
// If dest is directory copy src into dest
|
||||
dest = path.join(dest, path.basename(source));
|
||||
destExists = yield ioUtil.exists(dest);
|
||||
}
|
||||
if (destExists) {
|
||||
if (options.force == null || options.force) {
|
||||
yield rmRF(dest);
|
||||
}
|
||||
else {
|
||||
throw new Error('Destination already exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
yield mkdirP(path.dirname(dest));
|
||||
yield ioUtil.rename(source, dest);
|
||||
});
|
||||
}
|
||||
exports.mv = mv;
|
||||
|
@ -186,77 +231,59 @@ function which(tool, check) {
|
|||
});
|
||||
}
|
||||
exports.which = which;
|
||||
// Copies contents of source into dest, making any necessary folders along the way.
|
||||
// Deletes the original copy if deleteOriginal is true
|
||||
function copyDirectoryContents(source, dest, force, deleteOriginal = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (yield ioUtil.isDirectory(source)) {
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
if (!(yield ioUtil.isDirectory(dest))) {
|
||||
throw new Error(`${dest} is not a directory`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
yield mkdirP(dest);
|
||||
}
|
||||
// Copy all child files, and directories recursively
|
||||
const sourceChildren = yield ioUtil.readdir(source);
|
||||
for (const newSource of sourceChildren) {
|
||||
const newDest = path.join(dest, path.basename(newSource));
|
||||
yield copyDirectoryContents(path.resolve(source, newSource), newDest, force, deleteOriginal);
|
||||
}
|
||||
if (deleteOriginal) {
|
||||
yield ioUtil.rmdir(source);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (force) {
|
||||
yield ioUtil.copyFile(source, dest);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.copyFile(source, dest, fs.constants.COPYFILE_EXCL);
|
||||
}
|
||||
if (deleteOriginal) {
|
||||
yield ioUtil.unlink(source);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function move(source, dest, options = {}, moveOptions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
if (yield ioUtil.isDirectory(source)) {
|
||||
if (!recursive) {
|
||||
throw new Error(`non-recursive cp failed, ${source} is a directory`);
|
||||
}
|
||||
// If directory exists, move source inside it. Otherwise, create it and move contents of source inside.
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
if (!(yield ioUtil.isDirectory(dest))) {
|
||||
throw new Error(`${dest} is not a directory`);
|
||||
}
|
||||
dest = path.join(dest, path.basename(source));
|
||||
}
|
||||
yield copyDirectoryContents(source, dest, force, moveOptions.deleteOriginal);
|
||||
}
|
||||
else {
|
||||
if ((yield ioUtil.exists(dest)) && (yield ioUtil.isDirectory(dest))) {
|
||||
dest = path.join(dest, path.basename(source));
|
||||
}
|
||||
if (force) {
|
||||
yield ioUtil.copyFile(source, dest);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.copyFile(source, dest, fs.constants.COPYFILE_EXCL);
|
||||
}
|
||||
if (moveOptions.deleteOriginal) {
|
||||
yield ioUtil.unlink(source);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function readCopyOptions(options) {
|
||||
const force = options.force == null ? true : options.force;
|
||||
const recursive = Boolean(options.recursive);
|
||||
return { force, recursive };
|
||||
}
|
||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Ensure there is not a run away recursive copy
|
||||
if (currentDepth >= 255)
|
||||
return;
|
||||
currentDepth++;
|
||||
yield mkdirP(destDir);
|
||||
const files = yield ioUtil.readdir(sourceDir);
|
||||
for (const fileName of files) {
|
||||
const srcFile = `${sourceDir}/${fileName}`;
|
||||
const destFile = `${destDir}/${fileName}`;
|
||||
const srcFileStat = yield ioUtil.lstat(srcFile);
|
||||
if (srcFileStat.isDirectory()) {
|
||||
// Recurse
|
||||
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
||||
}
|
||||
else {
|
||||
yield copyFile(srcFile, destFile, force);
|
||||
}
|
||||
}
|
||||
// Change the mode for the newly created directory
|
||||
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
||||
});
|
||||
}
|
||||
// Buffered file copy
|
||||
function copyFile(srcFile, destFile, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
||||
// unlink/re-link it
|
||||
try {
|
||||
yield ioUtil.lstat(destFile);
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
catch (e) {
|
||||
// Try to override file permission
|
||||
if (e.code === 'EPERM') {
|
||||
yield ioUtil.chmod(destFile, '0666');
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
// other errors = it doesn't exist, no work to do
|
||||
}
|
||||
// Copy over symlink
|
||||
const symlinkFull = yield ioUtil.readlink(srcFile);
|
||||
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
||||
}
|
||||
else if (!(yield ioUtil.exists(destFile)) || force) {
|
||||
yield ioUtil.copyFile(srcFile, destFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=io.js.map
|
File diff suppressed because one or more lines are too long
|
@ -2,28 +2,28 @@
|
|||
"_from": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"_id": "@actions/io@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-BArfobXB/b6RjR4i/+P4UcdaqR2tPjEb2WzZf9GdKiSARQn7d301pKOZAqxA+0N11X07Lk46t/txeUBcrCNbeg==",
|
||||
"_integrity": "sha512-BZqiiacJkzERkYIMUQWrujLZWSFHEA6bD/LzR7QSDHpx32+PPk7NaUNmt8CG+y+OlYPc/ZZGaY3368K1ppfptA==",
|
||||
"_location": "/@actions/io",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"raw": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"name": "@actions/io",
|
||||
"escapedName": "@actions%2fio",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-io-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_shasum": "1e8f0faca6b39215bebacedf473e5bb0716e39bf",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_shasum": "64c85baec8d8ed889a5fb8e2ef794e36a692eeb8",
|
||||
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
"_from": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_id": "@actions/tool-cache@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-NavDg5VFXDfbe9TpFuj+uOHacjg1bT3Wmo3DQuul3gsGRBEXyzhh2MWKnBZs/Zh7FE3prLmIqpbtymafNBFkIA==",
|
||||
"_integrity": "sha512-+zx33p3tWhX1XLMVCGt+1JAv5IU6to/Ow64fBUdiRlVMlcGrMXuVQQ07HXtBpJG2g4P8q7x7UtLbfXxDgAij3w==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"name": "@actions/tool-cache",
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_shasum": "fa216c10f724010a74602fd14881f25f5b008070",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_shasum": "964b6bfaa22ff6401f82e233ef5bb684a8b6a160",
|
||||
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
{
|
||||
"_from": "semver@^6.1.1",
|
||||
"_args": [
|
||||
[
|
||||
"semver@6.1.2",
|
||||
"C:\\Users\\damccorm\\Documents\\setup-java"
|
||||
]
|
||||
],
|
||||
"_from": "semver@6.1.2",
|
||||
"_id": "semver@6.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ==",
|
||||
"_location": "/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "semver@^6.1.1",
|
||||
"raw": "semver@6.1.2",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "^6.1.1",
|
||||
"rawSpec": "6.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.1.1"
|
||||
"fetchSpec": "6.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
|
@ -21,17 +27,14 @@
|
|||
"/istanbul-lib-instrument"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz",
|
||||
"_shasum": "079960381376a3db62eb2edc8a3bfb10c7cfe318",
|
||||
"_spec": "semver@^6.1.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_spec": "6.1.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^14.1.6"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz",
|
||||
"_shasum": "2d3785a158c174c9a16dc2c046ec5fc5f1742213",
|
||||
"_spec": "tunnel@0.0.4",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node\\node_modules\\typed-rest-client",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java\\node_modules\\typed-rest-client",
|
||||
"author": {
|
||||
"name": "Koichi Kobayashi",
|
||||
"email": "koichik@improvement.jp"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz",
|
||||
"_shasum": "c0dda6e775b942fd46a2d99f2160a94953206fc2",
|
||||
"_spec": "typed-rest-client@^1.4.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
||||
"_spec": "underscore@1.8.3",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node\\node_modules\\typed-rest-client",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java\\node_modules\\typed-rest-client",
|
||||
"author": {
|
||||
"name": "Jeremy Ashkenas",
|
||||
"email": "jeremy@documentcloud.org"
|
||||
|
|
|
@ -1,28 +1,33 @@
|
|||
{
|
||||
"_from": "uuid@^3.3.2",
|
||||
"_args": [
|
||||
[
|
||||
"uuid@3.3.2",
|
||||
"C:\\Users\\damccorm\\Documents\\setup-java"
|
||||
]
|
||||
],
|
||||
"_from": "uuid@3.3.2",
|
||||
"_id": "uuid@3.3.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
|
||||
"_location": "/uuid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "uuid@^3.3.2",
|
||||
"raw": "uuid@3.3.2",
|
||||
"name": "uuid",
|
||||
"escapedName": "uuid",
|
||||
"rawSpec": "^3.3.2",
|
||||
"rawSpec": "3.3.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.3.2"
|
||||
"fetchSpec": "3.3.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache",
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"_shasum": "1b4af4955eb3077c501c23872fc6513811587131",
|
||||
"_spec": "uuid@^3.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_spec": "3.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-java",
|
||||
"bin": {
|
||||
"uuid": "./bin/uuid"
|
||||
},
|
||||
|
@ -34,7 +39,6 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/kelektiv/node-uuid/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
|
@ -62,7 +66,6 @@
|
|||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "7.0.0",
|
||||
|
|
|
@ -5,27 +5,20 @@
|
|||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "file:../../../damccorm/Documents/setup-node/toolkit/actions-core-0.0.0.tgz",
|
||||
"integrity": "sha512-58ituSV1rzBMmmsWoFDnrnsT+Wm4kD/u9NgAGbPvZ7rQHWluYtD5bDbIsjDC6rKFuhqytkxDJPsF/TWBdgc/nA==",
|
||||
"requires": {
|
||||
"@actions/exit": "^0.0.0"
|
||||
}
|
||||
"version": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"integrity": "sha512-aA3W5QTRIbaRxEDo/Pn/unVB+PB6Vbyx2QNjnV35QRDsdhbMd65e3Gige0NCkjoJ3P+P1Fv5B9jb7XV78yUBIQ=="
|
||||
},
|
||||
"@actions/exec": {
|
||||
"version": "file:../../../damccorm/Documents/setup-node/toolkit/actions-exec-0.0.0.tgz",
|
||||
"integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A=="
|
||||
},
|
||||
"@actions/exit": {
|
||||
"version": "file:../../../damccorm/Documents/setup-node/toolkit/actions-exit-0.0.0.tgz",
|
||||
"integrity": "sha512-vQdxFWM0/AERkC79mQ886SqPmV4joWhrSF7hiSTiJoKkE9eTjrKV5WQtp7SXv6OntrQkKX+ZjgdGpv+0rvJRCw=="
|
||||
"version": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"integrity": "sha512-Ha//34XKSv82P6QaaLwNK9cUJA2qzqPxRm1Cv0Wgj3k1ppS9MPjuCKQGvZI0CsbEs3UFq+NPorcbiAKM8smJWw=="
|
||||
},
|
||||
"@actions/io": {
|
||||
"version": "file:../../../damccorm/Documents/setup-node/toolkit/actions-io-0.0.0.tgz",
|
||||
"integrity": "sha512-BArfobXB/b6RjR4i/+P4UcdaqR2tPjEb2WzZf9GdKiSARQn7d301pKOZAqxA+0N11X07Lk46t/txeUBcrCNbeg=="
|
||||
"version": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"integrity": "sha512-BZqiiacJkzERkYIMUQWrujLZWSFHEA6bD/LzR7QSDHpx32+PPk7NaUNmt8CG+y+OlYPc/ZZGaY3368K1ppfptA=="
|
||||
},
|
||||
"@actions/tool-cache": {
|
||||
"version": "file:../../../damccorm/Documents/setup-node/toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"integrity": "sha512-NavDg5VFXDfbe9TpFuj+uOHacjg1bT3Wmo3DQuul3gsGRBEXyzhh2MWKnBZs/Zh7FE3prLmIqpbtymafNBFkIA==",
|
||||
"version": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"integrity": "sha512-+zx33p3tWhX1XLMVCGt+1JAv5IU6to/Ow64fBUdiRlVMlcGrMXuVQQ07HXtBpJG2g4P8q7x7UtLbfXxDgAij3w==",
|
||||
"requires": {
|
||||
"@actions/core": "^0.0.0",
|
||||
"@actions/exec": "^0.0.0",
|
||||
|
@ -2484,15 +2477,16 @@
|
|||
}
|
||||
},
|
||||
"husky": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-2.5.0.tgz",
|
||||
"integrity": "sha512-/aQIBaVMuzGi5X5BPliDPbHE+G+HDpWV7Zu28DiiXFMvHQcOeTsEnODWIGKyGBp7GM7rOgkxQdF+6AEo6xNtkw==",
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-3.0.0.tgz",
|
||||
"integrity": "sha512-lKMEn7bRK+7f5eWPNGclDVciYNQt0GIkAQmhKl+uHP1qFzoN0h92kmH9HZ8PCwyVA2EQPD8KHf0FYWqnTxau+Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cosmiconfig": "^5.2.1",
|
||||
"execa": "^1.0.0",
|
||||
"get-stdin": "^7.0.0",
|
||||
"is-ci": "^2.0.0",
|
||||
"opencollective-postinstall": "^2.0.2",
|
||||
"pkg-dir": "^4.2.0",
|
||||
"please-upgrade-node": "^3.1.1",
|
||||
"read-pkg": "^5.1.1",
|
||||
|
@ -3532,6 +3526,12 @@
|
|||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lines-and-columns": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
||||
"integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=",
|
||||
"dev": true
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
|
@ -3965,6 +3965,12 @@
|
|||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"opencollective-postinstall": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz",
|
||||
"integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==",
|
||||
"dev": true
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
|
||||
|
@ -4254,15 +4260,29 @@
|
|||
"dev": true
|
||||
},
|
||||
"read-pkg": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.1.1.tgz",
|
||||
"integrity": "sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w==",
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
|
||||
"integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/normalize-package-data": "^2.4.0",
|
||||
"normalize-package-data": "^2.5.0",
|
||||
"parse-json": "^4.0.0",
|
||||
"type-fest": "^0.4.1"
|
||||
"parse-json": "^5.0.0",
|
||||
"type-fest": "^0.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"parse-json": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
|
||||
"integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-better-errors": "^1.0.1",
|
||||
"lines-and-columns": "^1.1.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"read-pkg-up": {
|
||||
|
@ -5143,9 +5163,9 @@
|
|||
}
|
||||
},
|
||||
"type-fest": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.4.1.tgz",
|
||||
"integrity": "sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw==",
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
|
||||
"integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",
|
||||
"dev": true
|
||||
},
|
||||
"typed-rest-client": {
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/exit": "file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"@actions/core": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"@actions/io": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"@actions/exec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"@actions/io": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"@actions/tool-cache": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"semver": "^6.1.1"
|
||||
},
|
||||
|
@ -33,7 +32,7 @@
|
|||
"@types/jest": "^24.0.13",
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/semver": "^6.0.0",
|
||||
"husky": "^2.3.0",
|
||||
"husky": "^3.0.0",
|
||||
"jest": "^24.8.0",
|
||||
"jest-circus": "^24.7.1",
|
||||
"prettier": "^1.17.1",
|
||||
|
|
|
@ -6,6 +6,7 @@ import * as exec from '@actions/exec';
|
|||
import * as tc from '@actions/tool-cache';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as httpm from 'typed-rest-client/HttpClient';
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
|
@ -34,13 +35,15 @@ export async function getJava(
|
|||
if (toolPath) {
|
||||
core.debug(`Tool found in cache ${toolPath}`);
|
||||
} else {
|
||||
let compressedFileExtension = '';
|
||||
if (!jdkFile) {
|
||||
throw new Error(
|
||||
`Failed to find Java ${version} in the cache. Please specify a valid jdk file to install from instead.`
|
||||
);
|
||||
}
|
||||
core.debug('Downloading Jdk from Azul');
|
||||
jdkFile = await downloadJava(version);
|
||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||
} else {
|
||||
core.debug('Retrieving Jdk from local path');
|
||||
const compressedFileExtension = getFileEnding(jdkFile);
|
||||
}
|
||||
compressedFileExtension = compressedFileExtension || getFileEnding(jdkFile);
|
||||
let tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
'temp_' + Math.floor(Math.random() * 2000000000)
|
||||
|
@ -51,7 +54,12 @@ export async function getJava(
|
|||
tempDir
|
||||
);
|
||||
core.debug(`jdk extracted to ${jdkDir}`);
|
||||
toolPath = await tc.cacheDir(jdkDir, 'Java', `${version}.0.0`, arch);
|
||||
toolPath = await tc.cacheDir(
|
||||
jdkDir,
|
||||
'Java',
|
||||
normalizeVersion(version),
|
||||
arch
|
||||
);
|
||||
}
|
||||
|
||||
let extendedJavaHome = 'JAVA_HOME_' + version + '_' + arch;
|
||||
|
@ -60,6 +68,14 @@ export async function getJava(
|
|||
core.addPath(path.join(toolPath, 'bin'));
|
||||
}
|
||||
|
||||
function normalizeVersion(version: string) {
|
||||
const versionArray = version.split('.');
|
||||
const major = versionArray[0];
|
||||
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
||||
const patch = versionArray.length > 2 ? versionArray[2] : '0';
|
||||
return `${major}.${minor}.${patch}`;
|
||||
}
|
||||
|
||||
function getFileEnding(file: string): string {
|
||||
let fileEnding = '';
|
||||
|
||||
|
@ -124,7 +140,8 @@ async function unpackJars(fsPath: string, javaBinPath: string) {
|
|||
async function unzipJavaDownload(
|
||||
repoRoot: string,
|
||||
fileEnding: string,
|
||||
destinationFolder: string
|
||||
destinationFolder: string,
|
||||
extension?: string
|
||||
): Promise<string> {
|
||||
// Create the destination folder if it doesn't exist
|
||||
await io.mkdirP(destinationFolder);
|
||||
|
@ -143,3 +160,38 @@ async function unzipJavaDownload(
|
|||
throw new Error(`Jdk argument ${jdkFile} is not a file`);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadJava(version: string): Promise<string> {
|
||||
let filterString = '';
|
||||
if (IS_WINDOWS) {
|
||||
filterString = `jdk${version}-win_x64.zip`;
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
filterString = `jdk${version}-macosx_x64.tar.gz`;
|
||||
} else {
|
||||
filterString = `jdk${version}-linux_x64.tar.gz`;
|
||||
}
|
||||
}
|
||||
let http: httpm.HttpClient = new httpm.HttpClient('setup-java');
|
||||
let contents = await (await http.get(
|
||||
'https://static.azul.com/zulu/bin/'
|
||||
)).readBody();
|
||||
let refs = contents.match(/<a href.*\">/gi) || [];
|
||||
refs = refs.filter(val => {
|
||||
if (val.indexOf(filterString) > -1) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (refs.length == 0) {
|
||||
throw new Error(
|
||||
`No valid download found for version ${version}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`
|
||||
);
|
||||
}
|
||||
|
||||
const fileName = refs[0].slice(
|
||||
'<a href="'.length,
|
||||
refs[0].length - '">'.length
|
||||
);
|
||||
return await tc.downloadTool(`https://static.azul.com/zulu/bin/${fileName}`);
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue