mirror of
https://github.com/actions/setup-go.git
synced 2024-11-15 11:54:34 +08:00
Merge branch 'master' into features/matcher
This commit is contained in:
commit
5331f86a70
@ -10,12 +10,65 @@ process.env['RUNNER_TOOLSDIRECTORY'] = toolDir;
|
||||
process.env['RUNNER_TEMPDIRECTORY'] = tempDir;
|
||||
import * as installer from '../src/installer';
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
describe('installer tests', () => {
|
||||
beforeAll(() => {});
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
}, 100000);
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('Acquires version of go if no matching version is installed', async () => {
|
||||
await installer.getGo('1.10');
|
||||
const goDir = path.join(toolDir, 'go', '1.10.0', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('Throws if no location contains correct go version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await installer.getGo('1000.0');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
|
||||
it('TODO - Add tests', async () => {});
|
||||
it('Uses version of go installed in cache', async () => {
|
||||
const goDir: string = path.join(toolDir, 'go', '250.0.0', os.arch());
|
||||
await io.mkdirP(goDir);
|
||||
fs.writeFileSync(`${goDir}.complete`, 'hello');
|
||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||
await installer.getGo('250.0');
|
||||
return;
|
||||
});
|
||||
|
||||
it('Doesnt use version of go that was only partially installed in cache', async () => {
|
||||
const goDir: string = path.join(toolDir, 'go', '251.0.0', os.arch());
|
||||
await io.mkdirP(goDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||
await installer.getGo('251.0');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
134
lib/installer.js
Normal file
134
lib/installer.js
Normal file
@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// Load tempDirectory before it gets wiped by tool-cache
|
||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const util = __importStar(require("util"));
|
||||
let osPlat = os.platform();
|
||||
let osArch = os.arch();
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (process.platform === 'win32') {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
function getGo(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// check cache
|
||||
let toolPath;
|
||||
toolPath = tc.find('go', normalizeVersion(version));
|
||||
if (!toolPath) {
|
||||
// download, extract, cache
|
||||
toolPath = yield acquireGo(version);
|
||||
core.debug('Go tool is cached under ' + toolPath);
|
||||
}
|
||||
setGoEnvironmentVariables(toolPath);
|
||||
toolPath = path.join(toolPath, 'bin');
|
||||
//
|
||||
// prepend the tools path. instructs the agent to prepend for future tasks
|
||||
//
|
||||
core.addPath(toolPath);
|
||||
});
|
||||
}
|
||||
exports.getGo = getGo;
|
||||
function acquireGo(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
//
|
||||
// Download - a tool installer intimately knows how to get the tool (and construct urls)
|
||||
//
|
||||
let fileName = getFileName(version);
|
||||
let downloadUrl = getDownloadUrl(fileName);
|
||||
let downloadPath = null;
|
||||
try {
|
||||
downloadPath = yield tc.downloadTool(downloadUrl);
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(error);
|
||||
throw `Failed to download version ${version}: ${error}`;
|
||||
}
|
||||
//
|
||||
// Extract
|
||||
//
|
||||
let extPath = tempDirectory;
|
||||
if (!extPath) {
|
||||
throw new Error('Temp directory not set');
|
||||
}
|
||||
if (osPlat == 'win32') {
|
||||
extPath = yield tc.extractZip(downloadPath);
|
||||
}
|
||||
else {
|
||||
extPath = yield tc.extractTar(downloadPath);
|
||||
}
|
||||
//
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
//
|
||||
const toolRoot = path.join(extPath, 'go');
|
||||
version = normalizeVersion(version);
|
||||
return yield tc.cacheDir(toolRoot, 'go', version);
|
||||
});
|
||||
}
|
||||
function getFileName(version) {
|
||||
const platform = osPlat == 'win32' ? 'windows' : osPlat;
|
||||
const arch = osArch == 'x64' ? 'amd64' : '386';
|
||||
const ext = osPlat == 'win32' ? 'zip' : 'tar.gz';
|
||||
const filename = util.format('go%s.%s-%s.%s', version, platform, arch, ext);
|
||||
return filename;
|
||||
}
|
||||
function getDownloadUrl(filename) {
|
||||
return util.format('https://storage.googleapis.com/golang/%s', filename);
|
||||
}
|
||||
function setGoEnvironmentVariables(goRoot) {
|
||||
core.exportVariable('GOROOT', goRoot);
|
||||
const goPath = process.env['GOPATH'] || '';
|
||||
const goBin = process.env['GOBIN'] || '';
|
||||
// set GOPATH and GOBIN as user value
|
||||
if (goPath) {
|
||||
core.exportVariable('GOPATH', goPath);
|
||||
}
|
||||
if (goBin) {
|
||||
core.exportVariable('GOBIN', goBin);
|
||||
}
|
||||
}
|
||||
// This function is required to convert the version 1.10 to 1.10.0.
|
||||
// Because caching utility accept only sementic version,
|
||||
// which have patch number as well.
|
||||
function normalizeVersion(version) {
|
||||
const versionPart = version.split('.');
|
||||
if (versionPart[1] == null) {
|
||||
//append minor and patch version if not available
|
||||
return version.concat('.0.0');
|
||||
}
|
||||
else if (versionPart[2] == null) {
|
||||
//append patch version if not available
|
||||
return version.concat('.0');
|
||||
}
|
||||
return version;
|
||||
}
|
14
node_modules/@actions/core/README.md
generated
vendored
14
node_modules/@actions/core/README.md
generated
vendored
@ -1,7 +1,7 @@
|
||||
# `@actions/core`
|
||||
|
||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/core.ts](src/core.ts).
|
||||
# `@actions/core`
|
||||
|
||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/core.ts](src/core.ts).
|
||||
|
32
node_modules/@actions/core/lib/command.d.ts
generated
vendored
32
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@ -1,16 +1,16 @@
|
||||
interface CommandProperties {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||
export declare function issue(name: string, message: string): void;
|
||||
export {};
|
||||
interface CommandProperties {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||
export declare function issue(name: string, message: string): void;
|
||||
export {};
|
||||
|
130
node_modules/@actions/core/lib/command.js
generated
vendored
130
node_modules/@actions/core/lib/command.js
generated
vendored
@ -1,66 +1,66 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = require("os");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
process.stdout.write(cmd.toString() + os.EOL);
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
function issue(name, message) {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_PREFIX = '##[';
|
||||
class Command {
|
||||
constructor(command, properties, message) {
|
||||
if (!command) {
|
||||
command = 'missing.command';
|
||||
}
|
||||
this.command = command;
|
||||
this.properties = properties;
|
||||
this.message = message;
|
||||
}
|
||||
toString() {
|
||||
let cmdStr = CMD_PREFIX + this.command;
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
cmdStr += ' ';
|
||||
for (const key in this.properties) {
|
||||
if (this.properties.hasOwnProperty(key)) {
|
||||
const val = this.properties[key];
|
||||
if (val) {
|
||||
// safely append the val - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
cmdStr += `${key}=${escape(`${val || ''}`)};`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += ']';
|
||||
// safely append the message - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
const message = `${this.message || ''}`;
|
||||
cmdStr += escapeData(message);
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
||||
}
|
||||
function escape(s) {
|
||||
return s
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/]/g, '%5D')
|
||||
.replace(/;/g, '%3B');
|
||||
}
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = require("os");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
process.stdout.write(cmd.toString() + os.EOL);
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
function issue(name, message) {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_PREFIX = '##[';
|
||||
class Command {
|
||||
constructor(command, properties, message) {
|
||||
if (!command) {
|
||||
command = 'missing.command';
|
||||
}
|
||||
this.command = command;
|
||||
this.properties = properties;
|
||||
this.message = message;
|
||||
}
|
||||
toString() {
|
||||
let cmdStr = CMD_PREFIX + this.command;
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
cmdStr += ' ';
|
||||
for (const key in this.properties) {
|
||||
if (this.properties.hasOwnProperty(key)) {
|
||||
const val = this.properties[key];
|
||||
if (val) {
|
||||
// safely append the val - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
cmdStr += `${key}=${escape(`${val || ''}`)};`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += ']';
|
||||
// safely append the message - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
const message = `${this.message || ''}`;
|
||||
cmdStr += escapeData(message);
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
||||
}
|
||||
function escape(s) {
|
||||
return s
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/]/g, '%5D')
|
||||
.replace(/;/g, '%3B');
|
||||
}
|
||||
//# sourceMappingURL=command.js.map
|
114
node_modules/@actions/core/lib/core.d.ts
generated
vendored
114
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -1,57 +1,57 @@
|
||||
/**
|
||||
* Interface for getInput options
|
||||
*/
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: string): void;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
*/
|
||||
export declare function exportSecret(name: string, val: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
*/
|
||||
export declare function setNeutral(): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string): void;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
*/
|
||||
export declare function error(message: string): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
export declare function warning(message: string): void;
|
||||
/**
|
||||
* Interface for getInput options
|
||||
*/
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: string): void;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
*/
|
||||
export declare function exportSecret(name: string, val: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
*/
|
||||
export declare function setNeutral(): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string): void;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
*/
|
||||
export declare function error(message: string): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
export declare function warning(message: string): void;
|
||||
|
198
node_modules/@actions/core/lib/core.js
generated
vendored
198
node_modules/@actions/core/lib/core.js
generated
vendored
@ -1,100 +1,100 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exit_1 = require("@actions/exit");
|
||||
const command_1 = require("./command");
|
||||
const path = require("path");
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
function exportVariable(name, val) {
|
||||
process.env[name] = val;
|
||||
command_1.issueCommand('set-env', { name }, val);
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
*/
|
||||
function exportSecret(name, val) {
|
||||
exportVariable(name, val);
|
||||
command_1.issueCommand('set-secret', {}, val);
|
||||
}
|
||||
exports.exportSecret = exportSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
*/
|
||||
function setNeutral() {
|
||||
process.exitCode = exit_1.ExitCode.Neutral;
|
||||
}
|
||||
exports.setNeutral = setNeutral;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = exit_1.ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
function debug(message) {
|
||||
command_1.issueCommand('debug', {}, message);
|
||||
}
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
*/
|
||||
function error(message) {
|
||||
command_1.issue('error', message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exit_1 = require("@actions/exit");
|
||||
const command_1 = require("./command");
|
||||
const path = require("path");
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
function exportVariable(name, val) {
|
||||
process.env[name] = val;
|
||||
command_1.issueCommand('set-env', { name }, val);
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
*/
|
||||
function exportSecret(name, val) {
|
||||
exportVariable(name, val);
|
||||
command_1.issueCommand('set-secret', {}, val);
|
||||
}
|
||||
exports.exportSecret = exportSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
*/
|
||||
function setNeutral() {
|
||||
process.exitCode = exit_1.ExitCode.Neutral;
|
||||
}
|
||||
exports.setNeutral = setNeutral;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = exit_1.ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
function debug(message) {
|
||||
command_1.issueCommand('debug', {}, message);
|
||||
}
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
*/
|
||||
function error(message) {
|
||||
command_1.issue('error', message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
//# sourceMappingURL=core.js.map
|
30
node_modules/@actions/core/package.json
generated
vendored
30
node_modules/@actions/core/package.json
generated
vendored
@ -1,33 +1,29 @@
|
||||
{
|
||||
"_from": "file:toolkit\\actions-core-0.1.0.tgz",
|
||||
"_id": "@actions/core@0.1.0",
|
||||
"_from": "file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"_id": "@actions/core@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1I2vFY5r80QcbM1R8Ika5Ke9uWGrF8nl33oQuP3bXVG47wMIw1DdAVK0A17CHJe5ObHU4gpwTuQakUdZaOlg0w==",
|
||||
"_integrity": "sha512-58ituSV1rzBMmmsWoFDnrnsT+Wm4kD/u9NgAGbPvZ7rQHWluYtD5bDbIsjDC6rKFuhqytkxDJPsF/TWBdgc/nA==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"raw": "@actions/core@file:toolkit/actions-core-0.1.0.tgz",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"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.1.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-core-0.1.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-core-0.1.0.tgz"
|
||||
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-core-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-core-0.1.0.tgz",
|
||||
"_shasum": "a2d7cc689a05e28a677af34e2d69826d2029232c",
|
||||
"_spec": "@actions/core@file:toolkit/actions-core-0.1.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"author": {
|
||||
"name": "Bryan MacFarlane",
|
||||
"email": "bryanmac@microsoft.com"
|
||||
},
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-core-0.0.0.tgz",
|
||||
"_shasum": "346d90a534fa6c5021bc2e1b732574fd2c66fc35",
|
||||
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
@ -66,5 +62,5 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.1.0"
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
12
node_modules/@actions/exec/README.md
generated
vendored
12
node_modules/@actions/exec/README.md
generated
vendored
@ -1,7 +1,7 @@
|
||||
# `@actions/exec`
|
||||
|
||||
> Functions necessary for running tools on the command line
|
||||
|
||||
## Usage
|
||||
|
||||
# `@actions/exec`
|
||||
|
||||
> Functions necessary for running tools on the command line
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/exec.ts](src/exec.ts).
|
24
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
24
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
@ -1,12 +1,12 @@
|
||||
import * as im from './interfaces';
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
||||
import * as im from './interfaces';
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
||||
|
70
node_modules/@actions/exec/lib/exec.js
generated
vendored
70
node_modules/@actions/exec/lib/exec.js
generated
vendored
@ -1,36 +1,36 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tr = require("./toolrunner");
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
function exec(commandLine, args, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commandArgs = tr.argStringToArray(commandLine);
|
||||
if (commandArgs.length === 0) {
|
||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||
}
|
||||
// Path to tool to execute should be first arg
|
||||
const toolPath = commandArgs[0];
|
||||
args = commandArgs.slice(1).concat(args || []);
|
||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||
return runner.exec();
|
||||
});
|
||||
}
|
||||
exports.exec = exec;
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tr = require("./toolrunner");
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
function exec(commandLine, args, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commandArgs = tr.argStringToArray(commandLine);
|
||||
if (commandArgs.length === 0) {
|
||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||
}
|
||||
// Path to tool to execute should be first arg
|
||||
const toolPath = commandArgs[0];
|
||||
args = commandArgs.slice(1).concat(args || []);
|
||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||
return runner.exec();
|
||||
});
|
||||
}
|
||||
exports.exec = exec;
|
||||
//# sourceMappingURL=exec.js.map
|
70
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
70
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
@ -1,35 +1,35 @@
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
/**
|
||||
* Interface for exec options
|
||||
*/
|
||||
export interface ExecOptions {
|
||||
/** optional working directory. defaults to current */
|
||||
cwd?: string;
|
||||
/** optional envvar dictionary. defaults to current process's env */
|
||||
env?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/** optional. defaults to false */
|
||||
silent?: boolean;
|
||||
/** optional out stream to use. Defaults to process.stdout */
|
||||
outStream?: stream.Writable;
|
||||
/** optional err stream to use. Defaults to process.stderr */
|
||||
errStream?: stream.Writable;
|
||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
||||
windowsVerbatimArguments?: boolean;
|
||||
/** optional. whether to fail if output to stderr. defaults to false */
|
||||
failOnStdErr?: boolean;
|
||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
||||
ignoreReturnCode?: boolean;
|
||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
||||
delay?: number;
|
||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
||||
listeners?: {
|
||||
stdout?: (data: Buffer) => void;
|
||||
stderr?: (data: Buffer) => void;
|
||||
stdline?: (data: string) => void;
|
||||
errline?: (data: string) => void;
|
||||
debug?: (data: string) => void;
|
||||
};
|
||||
}
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
/**
|
||||
* Interface for exec options
|
||||
*/
|
||||
export interface ExecOptions {
|
||||
/** optional working directory. defaults to current */
|
||||
cwd?: string;
|
||||
/** optional envvar dictionary. defaults to current process's env */
|
||||
env?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/** optional. defaults to false */
|
||||
silent?: boolean;
|
||||
/** optional out stream to use. Defaults to process.stdout */
|
||||
outStream?: stream.Writable;
|
||||
/** optional err stream to use. Defaults to process.stderr */
|
||||
errStream?: stream.Writable;
|
||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
||||
windowsVerbatimArguments?: boolean;
|
||||
/** optional. whether to fail if output to stderr. defaults to false */
|
||||
failOnStdErr?: boolean;
|
||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
||||
ignoreReturnCode?: boolean;
|
||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
||||
delay?: number;
|
||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
||||
listeners?: {
|
||||
stdout?: (data: Buffer) => void;
|
||||
stderr?: (data: Buffer) => void;
|
||||
stdline?: (data: string) => void;
|
||||
errline?: (data: string) => void;
|
||||
debug?: (data: string) => void;
|
||||
};
|
||||
}
|
||||
|
4
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
4
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interfaces.js.map
|
74
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
74
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
@ -1,37 +1,37 @@
|
||||
/// <reference types="node" />
|
||||
import * as events from 'events';
|
||||
import * as im from './interfaces';
|
||||
export declare class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
||||
private toolPath;
|
||||
private args;
|
||||
private options;
|
||||
private _debug;
|
||||
private _getCommandString;
|
||||
private _processLineBuffer;
|
||||
private _getSpawnFileName;
|
||||
private _getSpawnArgs;
|
||||
private _endsWith;
|
||||
private _isCmdFile;
|
||||
private _windowsQuoteCmdArg;
|
||||
private _uvQuoteCmdArg;
|
||||
private _cloneExecOptions;
|
||||
private _getSpawnOptions;
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec(): Promise<number>;
|
||||
}
|
||||
/**
|
||||
* Convert an arg string to an array of args. Handles escaping
|
||||
*
|
||||
* @param argString string of arguments
|
||||
* @returns string[] array of arguments
|
||||
*/
|
||||
export declare function argStringToArray(argString: string): string[];
|
||||
/// <reference types="node" />
|
||||
import * as events from 'events';
|
||||
import * as im from './interfaces';
|
||||
export declare class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
||||
private toolPath;
|
||||
private args;
|
||||
private options;
|
||||
private _debug;
|
||||
private _getCommandString;
|
||||
private _processLineBuffer;
|
||||
private _getSpawnFileName;
|
||||
private _getSpawnArgs;
|
||||
private _endsWith;
|
||||
private _isCmdFile;
|
||||
private _windowsQuoteCmdArg;
|
||||
private _uvQuoteCmdArg;
|
||||
private _cloneExecOptions;
|
||||
private _getSpawnOptions;
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec(): Promise<number>;
|
||||
}
|
||||
/**
|
||||
* Convert an arg string to an array of args. Handles escaping
|
||||
*
|
||||
* @param argString string of arguments
|
||||
* @returns string[] array of arguments
|
||||
*/
|
||||
export declare function argStringToArray(argString: string): string[];
|
||||
|
1144
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
1144
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
File diff suppressed because it is too large
Load Diff
32
node_modules/@actions/exec/package.json
generated
vendored
32
node_modules/@actions/exec/package.json
generated
vendored
@ -1,33 +1,29 @@
|
||||
{
|
||||
"_from": "file:toolkit\\actions-exec-1.0.0.tgz",
|
||||
"_id": "@actions/exec@1.0.0",
|
||||
"_from": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_id": "@actions/exec@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-AxtupsjQceVIf6nEECts5a1pDpWO4r3yq5lpTA73g1FXA0awDdTW3r9NFn8NGF6UaydkIN0BEOasQlS5qS30zg==",
|
||||
"_integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A==",
|
||||
"_location": "/@actions/exec",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"raw": "@actions/exec@file:toolkit/actions-exec-1.0.0.tgz",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"raw": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-exec-1.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exec-1.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exec-1.0.0.tgz"
|
||||
"rawSpec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-exec-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exec-1.0.0.tgz",
|
||||
"_shasum": "6845691df4b14de24cf3b0a45c847070db8f9b6d",
|
||||
"_spec": "@actions/exec@file:toolkit/actions-exec-1.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"author": {
|
||||
"name": "Bryan MacFarlane",
|
||||
"email": "bryanmac@microsoft.com"
|
||||
},
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
|
||||
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
@ -35,7 +31,7 @@
|
||||
"deprecated": false,
|
||||
"description": "Actions exec lib",
|
||||
"devDependencies": {
|
||||
"@actions/io": "^1.0.0"
|
||||
"@actions/io": "^0.0.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
@ -63,5 +59,5 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
12
node_modules/@actions/exit/LICENSE.md
generated
vendored
12
node_modules/@actions/exit/LICENSE.md
generated
vendored
@ -1,7 +1,7 @@
|
||||
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.
|
||||
|
||||
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.
|
12
node_modules/@actions/exit/README.md
generated
vendored
12
node_modules/@actions/exit/README.md
generated
vendored
@ -1,7 +1,7 @@
|
||||
# `@actions/exit`
|
||||
|
||||
> TODO: description
|
||||
|
||||
## Usage
|
||||
|
||||
# `@actions/exit`
|
||||
|
||||
> TODO: description
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/exit.ts](src/exit.ts).
|
58
node_modules/@actions/exit/lib/exit.d.ts
generated
vendored
58
node_modules/@actions/exit/lib/exit.d.ts
generated
vendored
@ -1,29 +1,29 @@
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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;
|
||||
|
86
node_modules/@actions/exit/lib/exit.js
generated
vendored
86
node_modules/@actions/exit/lib/exit.js
generated
vendored
@ -1,44 +1,44 @@
|
||||
"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;
|
||||
"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
|
8
node_modules/@actions/exit/package.json
generated
vendored
8
node_modules/@actions/exit/package.json
generated
vendored
@ -7,23 +7,23 @@
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"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"
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-exit-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/core"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-exit-0.0.0.tgz",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-go\\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",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
96
node_modules/@actions/io/README.md
generated
vendored
96
node_modules/@actions/io/README.md
generated
vendored
@ -1,49 +1,49 @@
|
||||
# `@actions/io`
|
||||
|
||||
> Core functions for cli filesystem scenarios
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export function cp(source: string, dest: string, options?: CopyOptions): Promise<void>
|
||||
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param path path to remove
|
||||
*/
|
||||
export function rmRF(path: string): Promise<void>
|
||||
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
*
|
||||
* @param p path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export function mkdirP(p: string): Promise<void>
|
||||
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export function mv(source: string, dest: string, options?: CopyOptions): Promise<void>
|
||||
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param options optional. See WhichOptions.
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export function which(tool: string, options?: WhichOptions): Promise<string>
|
||||
# `@actions/io`
|
||||
|
||||
> Core functions for cli filesystem scenarios
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export function cp(source: string, dest: string, options?: CopyOptions): Promise<void>
|
||||
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param path path to remove
|
||||
*/
|
||||
export function rmRF(path: string): Promise<void>
|
||||
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
*
|
||||
* @param p path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export function mkdirP(p: string): Promise<void>
|
||||
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export function mv(source: string, dest: string, options?: CopyOptions): Promise<void>
|
||||
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param options optional. See WhichOptions.
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export function which(tool: string, options?: WhichOptions): Promise<string>
|
||||
```
|
58
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
58
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
@ -1,29 +1,29 @@
|
||||
/// <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 IS_WINDOWS: boolean;
|
||||
export declare function exists(fsPath: string): Promise<boolean>;
|
||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
export declare function isRooted(p: string): boolean;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
||||
/// <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 IS_WINDOWS: boolean;
|
||||
export declare function exists(fsPath: string): Promise<boolean>;
|
||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
export declare function isRooted(p: string): boolean;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
||||
|
386
node_modules/@actions/io/lib/io-util.js
generated
vendored
386
node_modules/@actions/io/lib/io-util.js
generated
vendored
@ -1,194 +1,194 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var _a;
|
||||
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;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
function exists(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
exports.exists = exists;
|
||||
function isDirectory(fsPath, useStat = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
||||
return stats.isDirectory();
|
||||
});
|
||||
}
|
||||
exports.isDirectory = isDirectory;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
function isRooted(p) {
|
||||
p = normalizeSeparators(p);
|
||||
if (!p) {
|
||||
throw new Error('isRooted() parameter "p" cannot be empty');
|
||||
}
|
||||
if (exports.IS_WINDOWS) {
|
||||
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
||||
); // e.g. C: or C:\hello
|
||||
}
|
||||
return p.startsWith('/');
|
||||
}
|
||||
exports.isRooted = isRooted;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||
fsPath = path.resolve(fsPath);
|
||||
if (depth >= maxDepth)
|
||||
return exports.mkdir(fsPath);
|
||||
try {
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
catch (err) {
|
||||
switch (err.code) {
|
||||
case 'ENOENT': {
|
||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
let stats;
|
||||
try {
|
||||
stats = yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err2) {
|
||||
throw err;
|
||||
}
|
||||
if (!stats.isDirectory())
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
function tryGetExecutablePath(filePath, extensions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let stats = undefined;
|
||||
try {
|
||||
// test file exists
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// on Windows, test for valid extension
|
||||
const upperExt = path.extname(filePath).toUpperCase();
|
||||
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
// try each extension
|
||||
const originalFilePath = filePath;
|
||||
for (const extension of extensions) {
|
||||
filePath = originalFilePath + extension;
|
||||
stats = undefined;
|
||||
try {
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// preserve the case of the actual file (since an extension was appended)
|
||||
try {
|
||||
const directory = path.dirname(filePath);
|
||||
const upperName = path.basename(filePath).toUpperCase();
|
||||
for (const actualName of yield exports.readdir(directory)) {
|
||||
if (upperName === actualName.toUpperCase()) {
|
||||
filePath = path.join(directory, actualName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
});
|
||||
}
|
||||
exports.tryGetExecutablePath = tryGetExecutablePath;
|
||||
function normalizeSeparators(p) {
|
||||
p = p || '';
|
||||
if (exports.IS_WINDOWS) {
|
||||
// convert slashes on Windows
|
||||
p = p.replace(/\//g, '\\');
|
||||
// remove redundant slashes
|
||||
return p.replace(/\\\\+/g, '\\');
|
||||
}
|
||||
// remove redundant slashes
|
||||
return p.replace(/\/\/+/g, '/');
|
||||
}
|
||||
// on Mac/Linux, test the execute bit
|
||||
// R W X R W X R W X
|
||||
// 256 128 64 32 16 8 4 2 1
|
||||
function isUnixExecutable(stats) {
|
||||
return ((stats.mode & 1) > 0 ||
|
||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||
}
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var _a;
|
||||
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;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
function exists(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
exports.exists = exists;
|
||||
function isDirectory(fsPath, useStat = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
||||
return stats.isDirectory();
|
||||
});
|
||||
}
|
||||
exports.isDirectory = isDirectory;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
function isRooted(p) {
|
||||
p = normalizeSeparators(p);
|
||||
if (!p) {
|
||||
throw new Error('isRooted() parameter "p" cannot be empty');
|
||||
}
|
||||
if (exports.IS_WINDOWS) {
|
||||
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
||||
); // e.g. C: or C:\hello
|
||||
}
|
||||
return p.startsWith('/');
|
||||
}
|
||||
exports.isRooted = isRooted;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||
fsPath = path.resolve(fsPath);
|
||||
if (depth >= maxDepth)
|
||||
return exports.mkdir(fsPath);
|
||||
try {
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
catch (err) {
|
||||
switch (err.code) {
|
||||
case 'ENOENT': {
|
||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
let stats;
|
||||
try {
|
||||
stats = yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err2) {
|
||||
throw err;
|
||||
}
|
||||
if (!stats.isDirectory())
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
function tryGetExecutablePath(filePath, extensions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let stats = undefined;
|
||||
try {
|
||||
// test file exists
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// on Windows, test for valid extension
|
||||
const upperExt = path.extname(filePath).toUpperCase();
|
||||
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
// try each extension
|
||||
const originalFilePath = filePath;
|
||||
for (const extension of extensions) {
|
||||
filePath = originalFilePath + extension;
|
||||
stats = undefined;
|
||||
try {
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// preserve the case of the actual file (since an extension was appended)
|
||||
try {
|
||||
const directory = path.dirname(filePath);
|
||||
const upperName = path.basename(filePath).toUpperCase();
|
||||
for (const actualName of yield exports.readdir(directory)) {
|
||||
if (upperName === actualName.toUpperCase()) {
|
||||
filePath = path.join(directory, actualName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
});
|
||||
}
|
||||
exports.tryGetExecutablePath = tryGetExecutablePath;
|
||||
function normalizeSeparators(p) {
|
||||
p = p || '';
|
||||
if (exports.IS_WINDOWS) {
|
||||
// convert slashes on Windows
|
||||
p = p.replace(/\//g, '\\');
|
||||
// remove redundant slashes
|
||||
return p.replace(/\\\\+/g, '\\');
|
||||
}
|
||||
// remove redundant slashes
|
||||
return p.replace(/\/\/+/g, '/');
|
||||
}
|
||||
// on Mac/Linux, test the execute bit
|
||||
// R W X R W X R W X
|
||||
// 256 128 64 32 16 8 4 2 1
|
||||
function isUnixExecutable(stats) {
|
||||
return ((stats.mode & 1) > 0 ||
|
||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||
}
|
||||
//# sourceMappingURL=io-util.js.map
|
96
node_modules/@actions/io/lib/io.d.ts
generated
vendored
96
node_modules/@actions/io/lib/io.d.ts
generated
vendored
@ -1,48 +1,48 @@
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface CopyOptions {
|
||||
/** Optional. Whether to recursively copy all subdirectories. Defaults to false */
|
||||
recursive?: boolean;
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export declare function mv(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
export declare function rmRF(inputPath: string): Promise<void>;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string): Promise<void>;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export declare function which(tool: string, check?: boolean): Promise<string>;
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface CopyOptions {
|
||||
/** Optional. Whether to recursively copy all subdirectories. Defaults to false */
|
||||
recursive?: boolean;
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export declare function mv(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
export declare function rmRF(inputPath: string): Promise<void>;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string): Promise<void>;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export declare function which(tool: string, check?: boolean): Promise<string>;
|
||||
|
522
node_modules/@actions/io/lib/io.js
generated
vendored
522
node_modules/@actions/io/lib/io.js
generated
vendored
@ -1,262 +1,262 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
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.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: false });
|
||||
});
|
||||
}
|
||||
exports.cp = cp;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
function mv(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: true });
|
||||
});
|
||||
}
|
||||
exports.mv = mv;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
function rmRF(inputPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||
try {
|
||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||
yield exec(`rd /s /q "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield exec(`del /f /a "${inputPath}"`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||
try {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
else {
|
||||
let isDir = false;
|
||||
try {
|
||||
isDir = yield ioUtil.isDirectory(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
return;
|
||||
}
|
||||
if (isDir) {
|
||||
yield exec(`rm -rf "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.rmRF = rmRF;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
function mkdirP(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield ioUtil.mkdirP(fsPath);
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
function which(tool, check) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!tool) {
|
||||
throw new Error("parameter 'tool' is required");
|
||||
}
|
||||
// recursive when check=true
|
||||
if (check) {
|
||||
const result = yield which(tool, false);
|
||||
if (!result) {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
// build the list of extensions to try
|
||||
const extensions = [];
|
||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
||||
if (extension) {
|
||||
extensions.push(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if it's rooted, return it if exists. otherwise return empty.
|
||||
if (ioUtil.isRooted(tool)) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// if any path separators, return empty
|
||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
||||
return '';
|
||||
}
|
||||
// build the list of directories
|
||||
//
|
||||
// Note, technically "where" checks the current directory on Windows. From a task lib perspective,
|
||||
// it feels like we should not do this. Checking the current directory seems like more of a use
|
||||
// case of a shell, and the which() function exposed by the task lib should strive for consistency
|
||||
// across platforms.
|
||||
const directories = [];
|
||||
if (process.env.PATH) {
|
||||
for (const p of process.env.PATH.split(path.delimiter)) {
|
||||
if (p) {
|
||||
directories.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
// return the first match
|
||||
for (const directory of directories) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`which failed with message ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
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 };
|
||||
}
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
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.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: false });
|
||||
});
|
||||
}
|
||||
exports.cp = cp;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
function mv(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield move(source, dest, options, { deleteOriginal: true });
|
||||
});
|
||||
}
|
||||
exports.mv = mv;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
function rmRF(inputPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||
try {
|
||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||
yield exec(`rd /s /q "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield exec(`del /f /a "${inputPath}"`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||
try {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
else {
|
||||
let isDir = false;
|
||||
try {
|
||||
isDir = yield ioUtil.isDirectory(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
return;
|
||||
}
|
||||
if (isDir) {
|
||||
yield exec(`rm -rf "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.rmRF = rmRF;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
function mkdirP(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield ioUtil.mkdirP(fsPath);
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
function which(tool, check) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!tool) {
|
||||
throw new Error("parameter 'tool' is required");
|
||||
}
|
||||
// recursive when check=true
|
||||
if (check) {
|
||||
const result = yield which(tool, false);
|
||||
if (!result) {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
// build the list of extensions to try
|
||||
const extensions = [];
|
||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
||||
if (extension) {
|
||||
extensions.push(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if it's rooted, return it if exists. otherwise return empty.
|
||||
if (ioUtil.isRooted(tool)) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// if any path separators, return empty
|
||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
||||
return '';
|
||||
}
|
||||
// build the list of directories
|
||||
//
|
||||
// Note, technically "where" checks the current directory on Windows. From a task lib perspective,
|
||||
// it feels like we should not do this. Checking the current directory seems like more of a use
|
||||
// case of a shell, and the which() function exposed by the task lib should strive for consistency
|
||||
// across platforms.
|
||||
const directories = [];
|
||||
if (process.env.PATH) {
|
||||
for (const p of process.env.PATH.split(path.delimiter)) {
|
||||
if (p) {
|
||||
directories.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
// return the first match
|
||||
for (const directory of directories) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`which failed with message ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
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 };
|
||||
}
|
||||
//# sourceMappingURL=io.js.map
|
30
node_modules/@actions/io/package.json
generated
vendored
30
node_modules/@actions/io/package.json
generated
vendored
@ -1,33 +1,29 @@
|
||||
{
|
||||
"_from": "file:toolkit\\actions-io-1.0.0.tgz",
|
||||
"_id": "@actions/io@1.0.0",
|
||||
"_from": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"_id": "@actions/io@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Dox3bRCdyxoG0o1mSHt/uINbyQ2SfbhtJmmMuUQny6ARB1hU8ZUi+XR0cHUfd/SrwdzLUrxX4dV8x8ylNSBQpA==",
|
||||
"_integrity": "sha512-BArfobXB/b6RjR4i/+P4UcdaqR2tPjEb2WzZf9GdKiSARQn7d301pKOZAqxA+0N11X07Lk46t/txeUBcrCNbeg==",
|
||||
"_location": "/@actions/io",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"raw": "@actions/io@file:toolkit/actions-io-1.0.0.tgz",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"raw": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"name": "@actions/io",
|
||||
"escapedName": "@actions%2fio",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-io-1.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-io-1.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-io-1.0.0.tgz"
|
||||
"rawSpec": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-io-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-io-1.0.0.tgz",
|
||||
"_shasum": "a395423c226d068e7caced224d51356ad15c41a7",
|
||||
"_spec": "@actions/io@file:toolkit/actions-io-1.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"author": {
|
||||
"name": "Danny McCormick",
|
||||
"email": "damccorm@microsoft.com"
|
||||
},
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_shasum": "1e8f0faca6b39215bebacedf473e5bb0716e39bf",
|
||||
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
@ -60,5 +56,5 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
12
node_modules/@actions/tool-cache/README.md
generated
vendored
12
node_modules/@actions/tool-cache/README.md
generated
vendored
@ -1,7 +1,7 @@
|
||||
# `@actions/tool-cache`
|
||||
|
||||
> Functions necessary for downloading and caching tools.
|
||||
|
||||
## Usage
|
||||
|
||||
# `@actions/tool-cache`
|
||||
|
||||
> Functions necessary for downloading and caching tools.
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/tool-cache.ts](src/tool-cache.ts).
|
149
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
149
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
@ -1,71 +1,78 @@
|
||||
export declare class HTTPError extends Error {
|
||||
readonly httpStatusCode: number | undefined;
|
||||
constructor(httpStatusCode: number | undefined);
|
||||
}
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
*
|
||||
* @param url url of tool to download
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
export declare function downloadTool(url: string): Promise<string>;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
* @param file path to the .7z file
|
||||
* @param dest destination directory. Optional.
|
||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||
* to 7zr.exe can be pass to this function.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
||||
/**
|
||||
* Extract a tar
|
||||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractTar(file: string, dest?: string): Promise<string>;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
* @param file path to the zip
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
* @param sourceDir the directory to cache into tools
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||
/**
|
||||
* Caches a downloaded file (GUID) and installs it
|
||||
* into the tool cache with a given targetName
|
||||
*
|
||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||
* @param targetFile the name of the file name in the tools directory
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||
/**
|
||||
* finds the path to a tool in the local installed tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param versionSpec version of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
||||
export declare class HTTPError extends Error {
|
||||
readonly httpStatusCode: number | undefined;
|
||||
constructor(httpStatusCode: number | undefined);
|
||||
}
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
*
|
||||
* @param url url of tool to download
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
export declare function downloadTool(url: string): Promise<string>;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
* @param file path to the .7z file
|
||||
* @param dest destination directory. Optional.
|
||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||
* to 7zr.exe can be pass to this function.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
||||
/**
|
||||
* Extract a tar
|
||||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractTar(file: string, dest?: string): Promise<string>;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
* @param file path to the zip
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
* @param sourceDir the directory to cache into tools
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||
/**
|
||||
* Caches a downloaded file (GUID) and installs it
|
||||
* into the tool cache with a given targetName
|
||||
*
|
||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||
* @param targetFile the name of the file name in the tools directory
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||
/**
|
||||
* Finds the path to a tool version in the local installed tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param versionSpec version of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
||||
/**
|
||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
export declare function findAllVersions(toolName: string, arch?: string): string[];
|
||||
|
865
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
865
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
@ -1,431 +1,436 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = require("@actions/core");
|
||||
const io = require("@actions/io");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const httpm = require("typed-rest-client/HttpClient");
|
||||
const semver = require("semver");
|
||||
const uuidV4 = require("uuid/v4");
|
||||
const exec_1 = require("@actions/exec/lib/exec");
|
||||
const assert_1 = require("assert");
|
||||
class HTTPError extends Error {
|
||||
constructor(httpStatusCode) {
|
||||
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
}
|
||||
exports.HTTPError = HTTPError;
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const userAgent = 'actions/tool-cache';
|
||||
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
|
||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||
let cacheRoot = process.env['RUNNER_TOOLSDIRECTORY'] || '';
|
||||
process.env['RUNNER_TEMPDIRECTORY'] = '';
|
||||
process.env['RUNNER_TOOLSDIRECTORY'] = '';
|
||||
// If directories not found, place them in common temp locations
|
||||
if (!tempDirectory || !cacheRoot) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
if (!tempDirectory) {
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
if (!cacheRoot) {
|
||||
cacheRoot = path.join(baseLocation, 'actions', 'cache');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
*
|
||||
* @param url url of tool to download
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
function downloadTool(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Wrap in a promise so that we can resolve from within stream callbacks
|
||||
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const http = new httpm.HttpClient(userAgent, [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
const destPath = path.join(tempDirectory, uuidV4());
|
||||
yield io.mkdirP(tempDirectory);
|
||||
core.debug(`Downloading ${url}`);
|
||||
core.debug(`Downloading ${destPath}`);
|
||||
if (fs.existsSync(destPath)) {
|
||||
throw new Error(`Destination file path ${destPath} already exists`);
|
||||
}
|
||||
const response = yield http.get(url);
|
||||
if (response.message.statusCode !== 200) {
|
||||
const err = new HTTPError(response.message.statusCode);
|
||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
throw err;
|
||||
}
|
||||
const file = fs.createWriteStream(destPath);
|
||||
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const stream = response.message.pipe(file);
|
||||
stream.on('close', () => {
|
||||
core.debug('download complete');
|
||||
resolve(destPath);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
file.on('error', err => {
|
||||
file.end();
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
exports.downloadTool = downloadTool;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
* @param file path to the .7z file
|
||||
* @param dest destination directory. Optional.
|
||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||
* to 7zr.exe can be pass to this function.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extract7z(file, dest, _7zPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
||||
assert_1.ok(file, 'parameter "file" is required');
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const originalCwd = process.cwd();
|
||||
process.chdir(dest);
|
||||
if (_7zPath) {
|
||||
try {
|
||||
const args = [
|
||||
'x',
|
||||
'-bb1',
|
||||
'-bd',
|
||||
'-sccUTF-8',
|
||||
file
|
||||
];
|
||||
const options = {
|
||||
silent: true
|
||||
};
|
||||
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
||||
}
|
||||
finally {
|
||||
process.chdir(originalCwd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const escapedScript = path
|
||||
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
||||
.replace(/'/g, "''")
|
||||
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
const options = {
|
||||
silent: true
|
||||
};
|
||||
try {
|
||||
const powershellPath = yield io.which('powershell', true);
|
||||
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
||||
}
|
||||
finally {
|
||||
process.chdir(originalCwd);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extract7z = extract7z;
|
||||
/**
|
||||
* Extract a tar
|
||||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractTar(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const tarPath = yield io.which('tar', true);
|
||||
yield exec_1.exec(`"${tarPath}"`, ['xzC', dest, '-f', file]);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
* @param file path to the zip
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractZip(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
if (IS_WINDOWS) {
|
||||
yield extractZipWin(file, dest);
|
||||
}
|
||||
else {
|
||||
yield extractZipNix(file, dest);
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractZip = extractZip;
|
||||
function extractZipWin(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// build the powershell command
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||
// run powershell
|
||||
const powershellPath = yield io.which('powershell');
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||
});
|
||||
}
|
||||
function extractZipNix(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
* @param sourceDir the directory to cache into tools
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
function cacheDir(sourceDir, tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
version = semver.clean(version) || version;
|
||||
arch = arch || os.arch();
|
||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||
core.debug(`source dir: ${sourceDir}`);
|
||||
if (!fs.statSync(sourceDir).isDirectory()) {
|
||||
throw new Error('sourceDir is not a directory');
|
||||
}
|
||||
// Create the tool dir
|
||||
const destPath = yield _createToolPath(tool, version, arch);
|
||||
// copy each child item. do not move. move can fail on Windows
|
||||
// due to anti-virus software having an open handle on a file.
|
||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||
const s = path.join(sourceDir, itemName);
|
||||
yield io.cp(s, destPath, { recursive: true });
|
||||
}
|
||||
// write .complete
|
||||
_completeToolPath(tool, version, arch);
|
||||
return destPath;
|
||||
});
|
||||
}
|
||||
exports.cacheDir = cacheDir;
|
||||
/**
|
||||
* Caches a downloaded file (GUID) and installs it
|
||||
* into the tool cache with a given targetName
|
||||
*
|
||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||
* @param targetFile the name of the file name in the tools directory
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
version = semver.clean(version) || version;
|
||||
arch = arch || os.arch();
|
||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||
core.debug(`source file: ${sourceFile}`);
|
||||
if (!fs.statSync(sourceFile).isFile()) {
|
||||
throw new Error('sourceFile is not a file');
|
||||
}
|
||||
// create the tool dir
|
||||
const destFolder = yield _createToolPath(tool, version, arch);
|
||||
// copy instead of move. move can fail on Windows due to
|
||||
// anti-virus software having an open handle on a file.
|
||||
const destPath = path.join(destFolder, targetFile);
|
||||
core.debug(`destination file ${destPath}`);
|
||||
yield io.cp(sourceFile, destPath);
|
||||
// write .complete
|
||||
_completeToolPath(tool, version, arch);
|
||||
return destFolder;
|
||||
});
|
||||
}
|
||||
exports.cacheFile = cacheFile;
|
||||
/**
|
||||
* finds the path to a tool in the local installed tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param versionSpec version of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
function find(toolName, versionSpec, arch) {
|
||||
if (!toolName) {
|
||||
throw new Error('toolName parameter is required');
|
||||
}
|
||||
if (!versionSpec) {
|
||||
throw new Error('versionSpec parameter is required');
|
||||
}
|
||||
arch = arch || os.arch();
|
||||
// attempt to resolve an explicit version
|
||||
if (!_isExplicitVersion(versionSpec)) {
|
||||
const localVersions = _findLocalToolVersions(toolName, arch);
|
||||
const match = _evaluateVersions(localVersions, versionSpec);
|
||||
versionSpec = match;
|
||||
}
|
||||
// check for the explicit version in the cache
|
||||
let toolPath = '';
|
||||
if (versionSpec) {
|
||||
versionSpec = semver.clean(versionSpec) || '';
|
||||
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
|
||||
core.debug(`checking cache: ${cachePath}`);
|
||||
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
||||
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
||||
toolPath = cachePath;
|
||||
}
|
||||
else {
|
||||
core.debug('not found');
|
||||
}
|
||||
}
|
||||
return toolPath;
|
||||
}
|
||||
exports.find = find;
|
||||
function _createExtractFolder(dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!dest) {
|
||||
// create a temp dir
|
||||
dest = path.join(tempDirectory, uuidV4());
|
||||
}
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
function _createToolPath(tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||
core.debug(`destination ${folderPath}`);
|
||||
const markerPath = `${folderPath}.complete`;
|
||||
yield io.rmRF(folderPath);
|
||||
yield io.rmRF(markerPath);
|
||||
yield io.mkdirP(folderPath);
|
||||
return folderPath;
|
||||
});
|
||||
}
|
||||
function _completeToolPath(tool, version, arch) {
|
||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||
const markerPath = `${folderPath}.complete`;
|
||||
fs.writeFileSync(markerPath, '');
|
||||
core.debug('finished caching tool');
|
||||
}
|
||||
function _isExplicitVersion(versionSpec) {
|
||||
const c = semver.clean(versionSpec) || '';
|
||||
core.debug(`isExplicit: ${c}`);
|
||||
const valid = semver.valid(c) != null;
|
||||
core.debug(`explicit? ${valid}`);
|
||||
return valid;
|
||||
}
|
||||
function _evaluateVersions(versions, versionSpec) {
|
||||
let version = '';
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
versions = versions.sort((a, b) => {
|
||||
if (semver.gt(a, b)) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
});
|
||||
for (let i = versions.length - 1; i >= 0; i--) {
|
||||
const potential = versions[i];
|
||||
const satisfied = semver.satisfies(potential, versionSpec);
|
||||
if (satisfied) {
|
||||
version = potential;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (version) {
|
||||
core.debug(`matched: ${version}`);
|
||||
}
|
||||
else {
|
||||
core.debug('match not found');
|
||||
}
|
||||
return version;
|
||||
}
|
||||
function _findLocalToolVersions(toolName, arch) {
|
||||
const versions = [];
|
||||
arch = arch || os.arch();
|
||||
const toolPath = path.join(cacheRoot, toolName);
|
||||
if (fs.existsSync(toolPath)) {
|
||||
const children = fs.readdirSync(toolPath);
|
||||
for (const child of children) {
|
||||
if (_isExplicitVersion(child)) {
|
||||
const fullPath = path.join(toolPath, child, arch || '');
|
||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||
versions.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return versions;
|
||||
}
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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 step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = require("@actions/core");
|
||||
const io = require("@actions/io");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const httpm = require("typed-rest-client/HttpClient");
|
||||
const semver = require("semver");
|
||||
const uuidV4 = require("uuid/v4");
|
||||
const exec_1 = require("@actions/exec/lib/exec");
|
||||
const assert_1 = require("assert");
|
||||
class HTTPError extends Error {
|
||||
constructor(httpStatusCode) {
|
||||
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
}
|
||||
exports.HTTPError = HTTPError;
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const userAgent = 'actions/tool-cache';
|
||||
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
|
||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||
let cacheRoot = process.env['RUNNER_TOOLSDIRECTORY'] || '';
|
||||
// If directories not found, place them in common temp locations
|
||||
if (!tempDirectory || !cacheRoot) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
if (!tempDirectory) {
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
if (!cacheRoot) {
|
||||
cacheRoot = path.join(baseLocation, 'actions', 'cache');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
*
|
||||
* @param url url of tool to download
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
function downloadTool(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Wrap in a promise so that we can resolve from within stream callbacks
|
||||
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const http = new httpm.HttpClient(userAgent, [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
const destPath = path.join(tempDirectory, uuidV4());
|
||||
yield io.mkdirP(tempDirectory);
|
||||
core.debug(`Downloading ${url}`);
|
||||
core.debug(`Downloading ${destPath}`);
|
||||
if (fs.existsSync(destPath)) {
|
||||
throw new Error(`Destination file path ${destPath} already exists`);
|
||||
}
|
||||
const response = yield http.get(url);
|
||||
if (response.message.statusCode !== 200) {
|
||||
const err = new HTTPError(response.message.statusCode);
|
||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
throw err;
|
||||
}
|
||||
const file = fs.createWriteStream(destPath);
|
||||
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const stream = response.message.pipe(file);
|
||||
stream.on('close', () => {
|
||||
core.debug('download complete');
|
||||
resolve(destPath);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
file.on('error', err => {
|
||||
file.end();
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
exports.downloadTool = downloadTool;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
* @param file path to the .7z file
|
||||
* @param dest destination directory. Optional.
|
||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||
* to 7zr.exe can be pass to this function.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extract7z(file, dest, _7zPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
||||
assert_1.ok(file, 'parameter "file" is required');
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const originalCwd = process.cwd();
|
||||
process.chdir(dest);
|
||||
if (_7zPath) {
|
||||
try {
|
||||
const args = [
|
||||
'x',
|
||||
'-bb1',
|
||||
'-bd',
|
||||
'-sccUTF-8',
|
||||
file
|
||||
];
|
||||
const options = {
|
||||
silent: true
|
||||
};
|
||||
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
||||
}
|
||||
finally {
|
||||
process.chdir(originalCwd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const escapedScript = path
|
||||
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
||||
.replace(/'/g, "''")
|
||||
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
const options = {
|
||||
silent: true
|
||||
};
|
||||
try {
|
||||
const powershellPath = yield io.which('powershell', true);
|
||||
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
||||
}
|
||||
finally {
|
||||
process.chdir(originalCwd);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extract7z = extract7z;
|
||||
/**
|
||||
* Extract a tar
|
||||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractTar(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const tarPath = yield io.which('tar', true);
|
||||
yield exec_1.exec(`"${tarPath}"`, ['xzC', dest, '-f', file]);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
* @param file path to the zip
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractZip(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
if (IS_WINDOWS) {
|
||||
yield extractZipWin(file, dest);
|
||||
}
|
||||
else {
|
||||
yield extractZipNix(file, dest);
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractZip = extractZip;
|
||||
function extractZipWin(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// build the powershell command
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||
// run powershell
|
||||
const powershellPath = yield io.which('powershell');
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||
});
|
||||
}
|
||||
function extractZipNix(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
* @param sourceDir the directory to cache into tools
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
function cacheDir(sourceDir, tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
version = semver.clean(version) || version;
|
||||
arch = arch || os.arch();
|
||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||
core.debug(`source dir: ${sourceDir}`);
|
||||
if (!fs.statSync(sourceDir).isDirectory()) {
|
||||
throw new Error('sourceDir is not a directory');
|
||||
}
|
||||
// Create the tool dir
|
||||
const destPath = yield _createToolPath(tool, version, arch);
|
||||
// copy each child item. do not move. move can fail on Windows
|
||||
// due to anti-virus software having an open handle on a file.
|
||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||
const s = path.join(sourceDir, itemName);
|
||||
yield io.cp(s, destPath, { recursive: true });
|
||||
}
|
||||
// write .complete
|
||||
_completeToolPath(tool, version, arch);
|
||||
return destPath;
|
||||
});
|
||||
}
|
||||
exports.cacheDir = cacheDir;
|
||||
/**
|
||||
* Caches a downloaded file (GUID) and installs it
|
||||
* into the tool cache with a given targetName
|
||||
*
|
||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||
* @param targetFile the name of the file name in the tools directory
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
version = semver.clean(version) || version;
|
||||
arch = arch || os.arch();
|
||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||
core.debug(`source file: ${sourceFile}`);
|
||||
if (!fs.statSync(sourceFile).isFile()) {
|
||||
throw new Error('sourceFile is not a file');
|
||||
}
|
||||
// create the tool dir
|
||||
const destFolder = yield _createToolPath(tool, version, arch);
|
||||
// copy instead of move. move can fail on Windows due to
|
||||
// anti-virus software having an open handle on a file.
|
||||
const destPath = path.join(destFolder, targetFile);
|
||||
core.debug(`destination file ${destPath}`);
|
||||
yield io.cp(sourceFile, destPath);
|
||||
// write .complete
|
||||
_completeToolPath(tool, version, arch);
|
||||
return destFolder;
|
||||
});
|
||||
}
|
||||
exports.cacheFile = cacheFile;
|
||||
/**
|
||||
* Finds the path to a tool version in the local installed tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param versionSpec version of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
function find(toolName, versionSpec, arch) {
|
||||
if (!toolName) {
|
||||
throw new Error('toolName parameter is required');
|
||||
}
|
||||
if (!versionSpec) {
|
||||
throw new Error('versionSpec parameter is required');
|
||||
}
|
||||
arch = arch || os.arch();
|
||||
// attempt to resolve an explicit version
|
||||
if (!_isExplicitVersion(versionSpec)) {
|
||||
const localVersions = findAllVersions(toolName, arch);
|
||||
const match = _evaluateVersions(localVersions, versionSpec);
|
||||
versionSpec = match;
|
||||
}
|
||||
// check for the explicit version in the cache
|
||||
let toolPath = '';
|
||||
if (versionSpec) {
|
||||
versionSpec = semver.clean(versionSpec) || '';
|
||||
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
|
||||
core.debug(`checking cache: ${cachePath}`);
|
||||
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
||||
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
||||
toolPath = cachePath;
|
||||
}
|
||||
else {
|
||||
core.debug('not found');
|
||||
}
|
||||
}
|
||||
return toolPath;
|
||||
}
|
||||
exports.find = find;
|
||||
/**
|
||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
function findAllVersions(toolName, arch) {
|
||||
const versions = [];
|
||||
arch = arch || os.arch();
|
||||
const toolPath = path.join(cacheRoot, toolName);
|
||||
if (fs.existsSync(toolPath)) {
|
||||
const children = fs.readdirSync(toolPath);
|
||||
for (const child of children) {
|
||||
if (_isExplicitVersion(child)) {
|
||||
const fullPath = path.join(toolPath, child, arch || '');
|
||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||
versions.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return versions;
|
||||
}
|
||||
exports.findAllVersions = findAllVersions;
|
||||
function _createExtractFolder(dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!dest) {
|
||||
// create a temp dir
|
||||
dest = path.join(tempDirectory, uuidV4());
|
||||
}
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
function _createToolPath(tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||
core.debug(`destination ${folderPath}`);
|
||||
const markerPath = `${folderPath}.complete`;
|
||||
yield io.rmRF(folderPath);
|
||||
yield io.rmRF(markerPath);
|
||||
yield io.mkdirP(folderPath);
|
||||
return folderPath;
|
||||
});
|
||||
}
|
||||
function _completeToolPath(tool, version, arch) {
|
||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||
const markerPath = `${folderPath}.complete`;
|
||||
fs.writeFileSync(markerPath, '');
|
||||
core.debug('finished caching tool');
|
||||
}
|
||||
function _isExplicitVersion(versionSpec) {
|
||||
const c = semver.clean(versionSpec) || '';
|
||||
core.debug(`isExplicit: ${c}`);
|
||||
const valid = semver.valid(c) != null;
|
||||
core.debug(`explicit? ${valid}`);
|
||||
return valid;
|
||||
}
|
||||
function _evaluateVersions(versions, versionSpec) {
|
||||
let version = '';
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
versions = versions.sort((a, b) => {
|
||||
if (semver.gt(a, b)) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
});
|
||||
for (let i = versions.length - 1; i >= 0; i--) {
|
||||
const potential = versions[i];
|
||||
const satisfied = semver.satisfies(potential, versionSpec);
|
||||
if (satisfied) {
|
||||
version = potential;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (version) {
|
||||
core.debug(`matched: ${version}`);
|
||||
}
|
||||
else {
|
||||
core.debug('match not found');
|
||||
}
|
||||
return version;
|
||||
}
|
||||
//# sourceMappingURL=tool-cache.js.map
|
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
File diff suppressed because one or more lines are too long
39
node_modules/@actions/tool-cache/package.json
generated
vendored
39
node_modules/@actions/tool-cache/package.json
generated
vendored
@ -1,44 +1,41 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/tool-cache@file:toolkit\\actions-tool-cache-1.0.0.tgz",
|
||||
"C:\\Users\\damccorm\\Documents\\setup-node"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/tool-cache@file:toolkit/actions-tool-cache-1.0.0.tgz",
|
||||
"_id": "@actions/tool-cache@file:toolkit/actions-tool-cache-1.0.0.tgz",
|
||||
"_from": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_id": "@actions/tool-cache@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hx8Z1ip11aZVA47uSCIB7Y9ec4Ty9zNPUyFyBsr0YI5vJ64TR/JoySbr0ck7l2EI0zqYAdef11Ynwz/qUkXVyg==",
|
||||
"_integrity": "sha512-NavDg5VFXDfbe9TpFuj+uOHacjg1bT3Wmo3DQuul3gsGRBEXyzhh2MWKnBZs/Zh7FE3prLmIqpbtymafNBFkIA==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-1.0.0.tgz",
|
||||
"where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"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-1.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-tool-cache-1.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-1.0.0.tgz"
|
||||
"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-go\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": false,
|
||||
"_spec": "file:toolkit/actions-tool-cache-1.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_shasum": "fa216c10f724010a74602fd14881f25f5b008070",
|
||||
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^0.1.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"@actions/core": "^0.0.0",
|
||||
"@actions/exec": "^0.0.0",
|
||||
"@actions/io": "^0.0.0",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions tool-cache lib",
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
@ -73,5 +70,5 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
118
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
118
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
@ -1,60 +1,60 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Source,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Target)
|
||||
|
||||
# This script translates the output from 7zdec into UTF8. Node has limited
|
||||
# built-in support for encodings.
|
||||
#
|
||||
# 7zdec uses the system default code page. The system default code page varies
|
||||
# depending on the locale configuration. On an en-US box, the system default code
|
||||
# page is Windows-1252.
|
||||
#
|
||||
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
||||
# determine whether data is passed correctly between processes. This is because
|
||||
# the 'ç' character has a different code point across each of the common encodings
|
||||
# on a typical en-US box, i.e.
|
||||
# 1) the default console-output code page (IBM437)
|
||||
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
||||
# 3) UTF8
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
||||
$stdout = [System.Console]::OpenStandardOutput()
|
||||
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
||||
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
||||
[System.Console]::SetOut($writer)
|
||||
|
||||
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
||||
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
||||
|
||||
Set-Location -LiteralPath $Target
|
||||
|
||||
# Print the ##command.
|
||||
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
||||
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
||||
|
||||
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
||||
# from the external command.
|
||||
$OutputEncoding = [System.Text.Encoding]::Default
|
||||
|
||||
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
||||
# will launch the external command in such a way that it inherits the streams.
|
||||
& $_7zdec x $Source 2>&1 |
|
||||
ForEach-Object {
|
||||
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
||||
[System.Console]::WriteLine($_.Exception.Message)
|
||||
}
|
||||
else {
|
||||
[System.Console]::WriteLine($_)
|
||||
}
|
||||
}
|
||||
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
||||
[System.Console]::Out.Flush()
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Source,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Target)
|
||||
|
||||
# This script translates the output from 7zdec into UTF8. Node has limited
|
||||
# built-in support for encodings.
|
||||
#
|
||||
# 7zdec uses the system default code page. The system default code page varies
|
||||
# depending on the locale configuration. On an en-US box, the system default code
|
||||
# page is Windows-1252.
|
||||
#
|
||||
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
||||
# determine whether data is passed correctly between processes. This is because
|
||||
# the 'ç' character has a different code point across each of the common encodings
|
||||
# on a typical en-US box, i.e.
|
||||
# 1) the default console-output code page (IBM437)
|
||||
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
||||
# 3) UTF8
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
||||
$stdout = [System.Console]::OpenStandardOutput()
|
||||
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
||||
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
||||
[System.Console]::SetOut($writer)
|
||||
|
||||
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
||||
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
||||
|
||||
Set-Location -LiteralPath $Target
|
||||
|
||||
# Print the ##command.
|
||||
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
||||
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
||||
|
||||
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
||||
# from the external command.
|
||||
$OutputEncoding = [System.Text.Encoding]::Default
|
||||
|
||||
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
||||
# will launch the external command in such a way that it inherits the streams.
|
||||
& $_7zdec x $Source 2>&1 |
|
||||
ForEach-Object {
|
||||
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
||||
[System.Console]::WriteLine($_.Exception.Message)
|
||||
}
|
||||
else {
|
||||
[System.Console]::WriteLine($_)
|
||||
}
|
||||
}
|
||||
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
||||
[System.Console]::Out.Flush()
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
31
node_modules/semver/package.json
generated
vendored
31
node_modules/semver/package.json
generated
vendored
@ -1,40 +1,37 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"semver@6.1.1",
|
||||
"C:\\Users\\damccorm\\Documents\\setup-node"
|
||||
]
|
||||
],
|
||||
"_from": "semver@6.1.1",
|
||||
"_id": "semver@6.1.1",
|
||||
"_from": "semver@^6.1.1",
|
||||
"_id": "semver@6.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ==",
|
||||
"_integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ==",
|
||||
"_location": "/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "semver@6.1.1",
|
||||
"raw": "semver@^6.1.1",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "6.1.1",
|
||||
"rawSpec": "^6.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.1.1"
|
||||
"fetchSpec": "^6.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache",
|
||||
"/istanbul-lib-instrument"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz",
|
||||
"_spec": "6.1.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz",
|
||||
"_shasum": "079960381376a3db62eb2edc8a3bfb10c7cfe318",
|
||||
"_spec": "semver@^6.1.1",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go",
|
||||
"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"
|
||||
@ -61,5 +58,5 @@
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"version": "6.1.1"
|
||||
"version": "6.1.2"
|
||||
}
|
||||
|
12
node_modules/semver/semver.js
generated
vendored
12
node_modules/semver/semver.js
generated
vendored
@ -810,7 +810,11 @@ Comparator.prototype.test = function (version) {
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
version = new SemVer(version, this.options)
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options)
|
||||
@ -1261,7 +1265,11 @@ Range.prototype.test = function (version) {
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
version = new SemVer(version, this.options)
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.set.length; i++) {
|
||||
|
2
node_modules/tunnel/package.json
generated
vendored
2
node_modules/tunnel/package.json
generated
vendored
@ -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-go\\node_modules\\typed-rest-client",
|
||||
"author": {
|
||||
"name": "Koichi Kobayashi",
|
||||
"email": "koichik@improvement.jp"
|
||||
|
30
node_modules/typed-rest-client/HttpClient.js
generated
vendored
30
node_modules/typed-rest-client/HttpClient.js
generated
vendored
@ -13,8 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const url = require("url");
|
||||
const http = require("http");
|
||||
const https = require("https");
|
||||
const tunnel = require("tunnel");
|
||||
const fs = require("fs");
|
||||
let fs;
|
||||
let tunnel;
|
||||
var HttpCodes;
|
||||
(function (HttpCodes) {
|
||||
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||
@ -101,15 +101,19 @@ class HttpClient {
|
||||
});
|
||||
}
|
||||
this._certConfig = requestOptions.cert;
|
||||
// cache the cert content into memory, so we don't have to read it from disk every time
|
||||
if (this._certConfig && this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) {
|
||||
this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8');
|
||||
}
|
||||
if (this._certConfig && this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) {
|
||||
this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8');
|
||||
}
|
||||
if (this._certConfig && this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) {
|
||||
this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8');
|
||||
if (this._certConfig) {
|
||||
// If using cert, need fs
|
||||
fs = require('fs');
|
||||
// cache the cert content into memory, so we don't have to read it from disk every time
|
||||
if (this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) {
|
||||
this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8');
|
||||
}
|
||||
if (this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) {
|
||||
this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8');
|
||||
}
|
||||
if (this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) {
|
||||
this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8');
|
||||
}
|
||||
}
|
||||
if (requestOptions.allowRedirects != null) {
|
||||
this._allowRedirects = requestOptions.allowRedirects;
|
||||
@ -354,6 +358,10 @@ class HttpClient {
|
||||
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
||||
}
|
||||
if (useProxy) {
|
||||
// If using proxy, need tunnel
|
||||
if (!tunnel) {
|
||||
tunnel = require('tunnel');
|
||||
}
|
||||
const agentOptions = {
|
||||
maxSockets: maxSockets,
|
||||
keepAlive: this._keepAlive,
|
||||
|
12
node_modules/typed-rest-client/package.json
generated
vendored
12
node_modules/typed-rest-client/package.json
generated
vendored
@ -1,8 +1,8 @@
|
||||
{
|
||||
"_from": "typed-rest-client@^1.4.0",
|
||||
"_id": "typed-rest-client@1.4.0",
|
||||
"_id": "typed-rest-client@1.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-f+3+X13CIpkv0WvFERkXq4aH5BYzyeYclf8t+X7oa/YaE80EjYW12kphY0aEQBaL9RzChP0MSbsVhB4X+bzyDw==",
|
||||
"_integrity": "sha512-DVZRlmsfnTjp6ZJaatcdyvvwYwbWvR4YDNFDqb+qdTxpvaVP99YCpBkA8rxsLtAPjBVoDe4fNsnMIdZTiPuKWg==",
|
||||
"_location": "/typed-rest-client",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
@ -18,10 +18,10 @@
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.4.0.tgz",
|
||||
"_shasum": "bf0f27684f8cbde05d32127ccb2cb8e0fe1a1b79",
|
||||
"_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-1.0.0.tgz",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
@ -69,5 +69,5 @@
|
||||
"units": "node make.js units",
|
||||
"validate": "node make.js validate"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
"version": "1.5.0"
|
||||
}
|
||||
|
2
node_modules/underscore/package.json
generated
vendored
2
node_modules/underscore/package.json
generated
vendored
@ -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-go\\node_modules\\typed-rest-client",
|
||||
"author": {
|
||||
"name": "Jeremy Ashkenas",
|
||||
"email": "jeremy@documentcloud.org"
|
||||
|
23
node_modules/uuid/package.json
generated
vendored
23
node_modules/uuid/package.json
generated
vendored
@ -1,33 +1,28 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"uuid@3.3.2",
|
||||
"C:\\Users\\damccorm\\Documents\\setup-node"
|
||||
]
|
||||
],
|
||||
"_from": "uuid@3.3.2",
|
||||
"_from": "uuid@^3.3.2",
|
||||
"_id": "uuid@3.3.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
|
||||
"_location": "/uuid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"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",
|
||||
"_spec": "3.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"_shasum": "1b4af4955eb3077c501c23872fc6513811587131",
|
||||
"_spec": "uuid@^3.3.2",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-go\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"bin": {
|
||||
"uuid": "./bin/uuid"
|
||||
},
|
||||
@ -39,6 +34,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/kelektiv/node-uuid/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
@ -66,6 +62,7 @@
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "7.0.0",
|
||||
|
10939
package-lock.json
generated
10939
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
98
package.json
98
package.json
@ -1,49 +1,49 @@
|
||||
{
|
||||
"name": "setup-go",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "setup go action",
|
||||
"main": "lib/setup-go.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/setup-go.git"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
"go",
|
||||
"setup"
|
||||
],
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "file:toolkit/actions-core-0.1.0.tgz",
|
||||
"@actions/exec": "file:toolkit/actions-exec-1.0.0.tgz",
|
||||
"@actions/exit": "file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"@actions/io": "file:toolkit/actions-io-1.0.0.tgz",
|
||||
"@actions/tool-cache": "file:toolkit/actions-tool-cache-1.0.0.tgz",
|
||||
"semver": "^6.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.13",
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/semver": "^6.0.0",
|
||||
"husky": "^2.3.0",
|
||||
"jest": "^24.8.0",
|
||||
"jest-circus": "^24.7.1",
|
||||
"prettier": "^1.17.1",
|
||||
"ts-jest": "^24.0.2",
|
||||
"typescript": "^3.5.1"
|
||||
},
|
||||
"husky": {
|
||||
"skipCI": true,
|
||||
"hooks": {
|
||||
"pre-commit": "npm run build && npm run format && npm prune --production && git add node_modules/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"name": "setup-go",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "setup go action",
|
||||
"main": "lib/setup-go.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/setup-go.git"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
"go",
|
||||
"setup"
|
||||
],
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"@actions/exec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"@actions/exit": "file:toolkit/actions-exit-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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.13",
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/semver": "^6.0.0",
|
||||
"husky": "^2.3.0",
|
||||
"jest": "^24.8.0",
|
||||
"jest-circus": "^24.7.1",
|
||||
"prettier": "^1.17.1",
|
||||
"ts-jest": "^24.0.2",
|
||||
"typescript": "^3.5.1"
|
||||
},
|
||||
"husky": {
|
||||
"skipCI": true,
|
||||
"hooks": {
|
||||
"pre-commit": "npm run build && npm run format && npm prune --production && git add node_modules/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
130
src/installer.ts
Normal file
130
src/installer.ts
Normal file
@ -0,0 +1,130 @@
|
||||
// Load tempDirectory before it gets wiped by tool-cache
|
||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||
import * as core from '@actions/core';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = os.arch();
|
||||
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (process.platform === 'win32') {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
} else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
|
||||
export async function getGo(version: string) {
|
||||
// check cache
|
||||
let toolPath: string;
|
||||
toolPath = tc.find('go', normalizeVersion(version));
|
||||
|
||||
if (!toolPath) {
|
||||
// download, extract, cache
|
||||
toolPath = await acquireGo(version);
|
||||
core.debug('Go tool is cached under ' + toolPath);
|
||||
}
|
||||
|
||||
setGoEnvironmentVariables(toolPath);
|
||||
|
||||
toolPath = path.join(toolPath, 'bin');
|
||||
//
|
||||
// prepend the tools path. instructs the agent to prepend for future tasks
|
||||
//
|
||||
core.addPath(toolPath);
|
||||
}
|
||||
|
||||
async function acquireGo(version: string): Promise<string> {
|
||||
//
|
||||
// Download - a tool installer intimately knows how to get the tool (and construct urls)
|
||||
//
|
||||
let fileName: string = getFileName(version);
|
||||
let downloadUrl: string = getDownloadUrl(fileName);
|
||||
let downloadPath: string | null = null;
|
||||
try {
|
||||
downloadPath = await tc.downloadTool(downloadUrl);
|
||||
} catch (error) {
|
||||
core.debug(error);
|
||||
|
||||
throw `Failed to download version ${version}: ${error}`;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract
|
||||
//
|
||||
let extPath: string = tempDirectory;
|
||||
if (!extPath) {
|
||||
throw new Error('Temp directory not set');
|
||||
}
|
||||
|
||||
if (osPlat == 'win32') {
|
||||
extPath = await tc.extractZip(downloadPath);
|
||||
} else {
|
||||
extPath = await tc.extractTar(downloadPath);
|
||||
}
|
||||
|
||||
//
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
//
|
||||
const toolRoot = path.join(extPath, 'go');
|
||||
version = normalizeVersion(version);
|
||||
return await tc.cacheDir(toolRoot, 'go', version);
|
||||
}
|
||||
|
||||
function getFileName(version: string): string {
|
||||
const platform: string = osPlat == 'win32' ? 'windows' : osPlat;
|
||||
const arch: string = osArch == 'x64' ? 'amd64' : '386';
|
||||
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
|
||||
const filename: string = util.format(
|
||||
'go%s.%s-%s.%s',
|
||||
version,
|
||||
platform,
|
||||
arch,
|
||||
ext
|
||||
);
|
||||
return filename;
|
||||
}
|
||||
|
||||
function getDownloadUrl(filename: string): string {
|
||||
return util.format('https://storage.googleapis.com/golang/%s', filename);
|
||||
}
|
||||
|
||||
function setGoEnvironmentVariables(goRoot: string) {
|
||||
core.exportVariable('GOROOT', goRoot);
|
||||
|
||||
const goPath: string = process.env['GOPATH'] || '';
|
||||
const goBin: string = process.env['GOBIN'] || '';
|
||||
|
||||
// set GOPATH and GOBIN as user value
|
||||
if (goPath) {
|
||||
core.exportVariable('GOPATH', goPath);
|
||||
}
|
||||
if (goBin) {
|
||||
core.exportVariable('GOBIN', goBin);
|
||||
}
|
||||
}
|
||||
|
||||
// This function is required to convert the version 1.10 to 1.10.0.
|
||||
// Because caching utility accept only sementic version,
|
||||
// which have patch number as well.
|
||||
function normalizeVersion(version: string): string {
|
||||
const versionPart = version.split('.');
|
||||
if (versionPart[1] == null) {
|
||||
//append minor and patch version if not available
|
||||
return version.concat('.0.0');
|
||||
} else if (versionPart[2] == null) {
|
||||
//append patch version if not available
|
||||
return version.concat('.0');
|
||||
}
|
||||
return version;
|
||||
}
|
BIN
toolkit/actions-core-0.0.0.tgz
Normal file
BIN
toolkit/actions-core-0.0.0.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-exec-0.0.0.tgz
Normal file
BIN
toolkit/actions-exec-0.0.0.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-io-0.0.0.tgz
Normal file
BIN
toolkit/actions-io-0.0.0.tgz
Normal file
Binary file not shown.
Binary file not shown.
BIN
toolkit/actions-tool-cache-0.0.0.tgz
Normal file
BIN
toolkit/actions-tool-cache-0.0.0.tgz
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user