Compare commits

..

12 Commits

Author SHA1 Message Date
Alif Rachmawadi
a471b152dc Merge pull request #97 from subosito/dependabot/npm_and_yarn/ws-7.4.6
Some checks failed
Main workflow / Run (ubuntu-latest) (push) Failing after 10m41s
Main workflow / Run (macos-latest) (push) Failing after 4s
Main workflow / Run (windows-latest) (push) Has been cancelled
Bump ws from 7.4.5 to 7.4.6
2021-06-11 15:33:35 +07:00
dependabot[bot]
56a652e69d Bump ws from 7.4.5 to 7.4.6
Bumps [ws](https://github.com/websockets/ws) from 7.4.5 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.5...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 08:20:48 +00:00
Alif Rachmawadi
8e1e9c4d87 update dist 2021-06-11 08:19:02 +00:00
Alif Rachmawadi
017da32f19 update dependencies 2021-06-11 08:18:38 +00:00
Alif Rachmawadi
cb226e935b Back to original path of release assets 2021-06-11 08:13:00 +00:00
Alif Rachmawadi
5188e41281 Merge pull request #100 from chatsen/master
Some checks failed
Main workflow / Run (ubuntu-latest) (push) Failing after 16m22s
Main workflow / Run (macos-latest) (push) Failing after 3s
Main workflow / Run (windows-latest) (push) Has been cancelled
Fix the endpoint for flutter releases
2021-06-02 10:48:10 +07:00
William Bulin
1ced41a989 Update index.js 2021-06-02 01:38:26 +02:00
William Bulin
4ac301c302 Update release.ts 2021-06-02 01:36:53 +02:00
Alif Rachmawadi
0600af6a5c Merge pull request #93 from subosito/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.7.1 to 2.8.9
2021-05-15 14:04:20 +07:00
dependabot[bot]
1c63d3b831 Bump hosted-git-info from 2.7.1 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.7.1 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 01:25:41 +00:00
Alif Rachmawadi
086f9fb649 Merge pull request #90 from kuhnroyal/feature/pub-cache
Export PUB_CACHE if it is not in env
2021-05-01 08:31:38 +07:00
Peter Leibiger
8f6ad7c383 Export PUB_CACHE if it is not in env
Export `PUB_CACHE` if it is not configured before calling the action.
This ensures that flutter and dart use the same cache.
It also enables other tools to use this official Dart env variable.
2021-04-28 20:43:14 +02:00
4 changed files with 486 additions and 200 deletions

582
dist/index.js vendored
View File

@@ -123,9 +123,14 @@ function getFlutter(version, channel) {
toolPath = yield tc.cacheDir(sdkDir, 'flutter', cleanver); toolPath = yield tc.cacheDir(sdkDir, 'flutter', cleanver);
} }
core.exportVariable('FLUTTER_ROOT', toolPath); core.exportVariable('FLUTTER_ROOT', toolPath);
let pubCachePath = process.env['PUB_CACHE'] || '';
if (!pubCachePath) {
pubCachePath = path.join(toolPath, '.pub-cache');
core.exportVariable('PUB_CACHE', pubCachePath);
}
core.addPath(path.join(toolPath, 'bin')); core.addPath(path.join(toolPath, 'bin'));
core.addPath(path.join(toolPath, 'bin', 'cache', 'dart-sdk', 'bin')); core.addPath(path.join(toolPath, 'bin', 'cache', 'dart-sdk', 'bin'));
core.addPath(path.join(toolPath, '.pub-cache', 'bin')); core.addPath(path.join(pubCachePath, 'bin'));
if (useMaster) { if (useMaster) {
yield exec.exec('flutter', ['channel', 'master']); yield exec.exec('flutter', ['channel', 'master']);
yield exec.exec('flutter', ['upgrade']); yield exec.exec('flutter', ['upgrade']);
@@ -353,14 +358,27 @@ function prefixCompare(version, releaseVersion) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
result["default"] = mod; __setModuleDefault(result, mod);
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.issue = exports.issueCommand = void 0;
const os = __importStar(__nccwpck_require__(2087)); const os = __importStar(__nccwpck_require__(2087));
const utils_1 = __nccwpck_require__(5278); const utils_1 = __nccwpck_require__(5278);
/** /**
@@ -439,6 +457,25 @@ function escapeProperty(s) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -448,14 +485,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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 })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
const command_1 = __nccwpck_require__(7351); const command_1 = __nccwpck_require__(7351);
const file_command_1 = __nccwpck_require__(717); const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(5278); const utils_1 = __nccwpck_require__(5278);
@@ -522,7 +553,9 @@ function addPath(inputPath) {
} }
exports.addPath = addPath; exports.addPath = addPath;
/** /**
* Gets the value of an input. The value is also trimmed. * Gets the value of an input.
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
* Returns an empty string if the value is not defined.
* *
* @param name name of the input to get * @param name name of the input to get
* @param options optional. See InputOptions. * @param options optional. See InputOptions.
@@ -533,9 +566,49 @@ function getInput(name, options) {
if (options && options.required && !val) { if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`); throw new Error(`Input required and not supplied: ${name}`);
} }
if (options && options.trimWhitespace === false) {
return val;
}
return val.trim(); return val.trim();
} }
exports.getInput = getInput; exports.getInput = getInput;
/**
* Gets the values of an multiline input. Each value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string[]
*
*/
function getMultilineInput(name, options) {
const inputs = getInput(name, options)
.split('\n')
.filter(x => x !== '');
return inputs;
}
exports.getMultilineInput = getMultilineInput;
/**
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
* The return value is also in boolean type.
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns boolean
*/
function getBooleanInput(name, options) {
const trueValue = ['true', 'True', 'TRUE'];
const falseValue = ['false', 'False', 'FALSE'];
const val = getInput(name, options);
if (trueValue.includes(val))
return true;
if (falseValue.includes(val))
return false;
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
}
exports.getBooleanInput = getBooleanInput;
/** /**
* Sets the value of an output. * Sets the value of an output.
* *
@@ -686,14 +759,27 @@ exports.getState = getState;
"use strict"; "use strict";
// For internal use, subject to change. // For internal use, subject to change.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
result["default"] = mod; __setModuleDefault(result, mod);
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.issueCommand = void 0;
// We use any as a valid input type // We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
const fs = __importStar(__nccwpck_require__(5747)); const fs = __importStar(__nccwpck_require__(5747));
@@ -724,6 +810,7 @@ exports.issueCommand = issueCommand;
// We use any as a valid input type // We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toCommandValue = void 0;
/** /**
* Sanitizes an input into a string so it can be passed into issueCommand safely * Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string * @param input input to sanitize into a string
@@ -747,6 +834,25 @@ exports.toCommandValue = toCommandValue;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -756,14 +862,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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 })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getExecOutput = exports.exec = void 0;
const string_decoder_1 = __nccwpck_require__(4304);
const tr = __importStar(__nccwpck_require__(8159)); const tr = __importStar(__nccwpck_require__(8159));
/** /**
* Exec a command. * Exec a command.
@@ -789,6 +890,51 @@ function exec(commandLine, args, options) {
}); });
} }
exports.exec = exec; exports.exec = exec;
/**
* Exec a command and get the output.
* Output will be streamed to the live console.
* Returns promise with the exit code and collected stdout and stderr
*
* @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<ExecOutput> exit code, stdout, and stderr
*/
function getExecOutput(commandLine, args, options) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
let stdout = '';
let stderr = '';
//Using string decoder covers the case where a mult-byte character is split
const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
const stdErrListener = (data) => {
stderr += stderrDecoder.write(data);
if (originalStdErrListener) {
originalStdErrListener(data);
}
};
const stdOutListener = (data) => {
stdout += stdoutDecoder.write(data);
if (originalStdoutListener) {
originalStdoutListener(data);
}
};
const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
//flush any remaining characters
stdout += stdoutDecoder.end();
stderr += stderrDecoder.end();
return {
exitCode,
stdout,
stderr
};
});
}
exports.getExecOutput = getExecOutput;
//# sourceMappingURL=exec.js.map //# sourceMappingURL=exec.js.map
/***/ }), /***/ }),
@@ -798,6 +944,25 @@ exports.exec = exec;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -807,20 +972,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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 })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.argStringToArray = exports.ToolRunner = void 0;
const os = __importStar(__nccwpck_require__(2087)); const os = __importStar(__nccwpck_require__(2087));
const events = __importStar(__nccwpck_require__(8614)); const events = __importStar(__nccwpck_require__(8614));
const child = __importStar(__nccwpck_require__(3129)); const child = __importStar(__nccwpck_require__(3129));
const path = __importStar(__nccwpck_require__(5622)); const path = __importStar(__nccwpck_require__(5622));
const io = __importStar(__nccwpck_require__(7436)); const io = __importStar(__nccwpck_require__(7436));
const ioUtil = __importStar(__nccwpck_require__(1962)); const ioUtil = __importStar(__nccwpck_require__(1962));
const timers_1 = __nccwpck_require__(8213);
/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/unbound-method */
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
/* /*
@@ -890,11 +1050,12 @@ class ToolRunner extends events.EventEmitter {
s = s.substring(n + os.EOL.length); s = s.substring(n + os.EOL.length);
n = s.indexOf(os.EOL); n = s.indexOf(os.EOL);
} }
strBuffer = s; return s;
} }
catch (err) { catch (err) {
// streaming lines to console is best effort. Don't fail a build. // streaming lines to console is best effort. Don't fail a build.
this._debug(`error processing line. Failed with error ${err}`); this._debug(`error processing line. Failed with error ${err}`);
return '';
} }
} }
_getSpawnFileName() { _getSpawnFileName() {
@@ -1176,7 +1337,7 @@ class ToolRunner extends events.EventEmitter {
// if the tool is only a file name, then resolve it from the PATH // if the tool is only a file name, then resolve it from the PATH
// otherwise verify it exists (add extension on Windows if necessary) // otherwise verify it exists (add extension on Windows if necessary)
this.toolPath = yield io.which(this.toolPath, true); this.toolPath = yield io.which(this.toolPath, true);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
this._debug(`exec tool: ${this.toolPath}`); this._debug(`exec tool: ${this.toolPath}`);
this._debug('arguments:'); this._debug('arguments:');
for (const arg of this.args) { for (const arg of this.args) {
@@ -1190,9 +1351,12 @@ class ToolRunner extends events.EventEmitter {
state.on('debug', (message) => { state.on('debug', (message) => {
this._debug(message); this._debug(message);
}); });
if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
}
const fileName = this._getSpawnFileName(); const fileName = this._getSpawnFileName();
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
const stdbuffer = ''; let stdbuffer = '';
if (cp.stdout) { if (cp.stdout) {
cp.stdout.on('data', (data) => { cp.stdout.on('data', (data) => {
if (this.options.listeners && this.options.listeners.stdout) { if (this.options.listeners && this.options.listeners.stdout) {
@@ -1201,14 +1365,14 @@ class ToolRunner extends events.EventEmitter {
if (!optionsNonNull.silent && optionsNonNull.outStream) { if (!optionsNonNull.silent && optionsNonNull.outStream) {
optionsNonNull.outStream.write(data); optionsNonNull.outStream.write(data);
} }
this._processLineBuffer(data, stdbuffer, (line) => { stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
if (this.options.listeners && this.options.listeners.stdline) { if (this.options.listeners && this.options.listeners.stdline) {
this.options.listeners.stdline(line); this.options.listeners.stdline(line);
} }
}); });
}); });
} }
const errbuffer = ''; let errbuffer = '';
if (cp.stderr) { if (cp.stderr) {
cp.stderr.on('data', (data) => { cp.stderr.on('data', (data) => {
state.processStderr = true; state.processStderr = true;
@@ -1223,7 +1387,7 @@ class ToolRunner extends events.EventEmitter {
: optionsNonNull.outStream; : optionsNonNull.outStream;
s.write(data); s.write(data);
} }
this._processLineBuffer(data, errbuffer, (line) => { errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
if (this.options.listeners && this.options.listeners.errline) { if (this.options.listeners && this.options.listeners.errline) {
this.options.listeners.errline(line); this.options.listeners.errline(line);
} }
@@ -1270,7 +1434,7 @@ class ToolRunner extends events.EventEmitter {
} }
cp.stdin.end(this.options.input); cp.stdin.end(this.options.input);
} }
}); }));
}); });
} }
} }
@@ -1356,7 +1520,7 @@ class ExecState extends events.EventEmitter {
this._setResult(); this._setResult();
} }
else if (this.processExited) { else if (this.processExited) {
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this); this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
} }
} }
_debug(message) { _debug(message) {
@@ -2015,6 +2179,25 @@ exports.checkBypass = checkBypass;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -2024,16 +2207,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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;
};
var _a; var _a;
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const assert_1 = __nccwpck_require__(2357); exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
const fs = __importStar(__nccwpck_require__(5747)); const fs = __importStar(__nccwpck_require__(5747));
const path = __importStar(__nccwpck_require__(5622)); const path = __importStar(__nccwpck_require__(5622));
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
@@ -2076,49 +2252,6 @@ function isRooted(p) {
return p.startsWith('/'); return p.startsWith('/');
} }
exports.isRooted = isRooted; 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. * Best effort attempt to determine whether a file exists and is executable.
* @param filePath file path to check * @param filePath file path to check
@@ -2215,6 +2348,12 @@ function isUnixExecutable(stats) {
((stats.mode & 8) > 0 && stats.gid === process.getgid()) || ((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
((stats.mode & 64) > 0 && stats.uid === process.getuid())); ((stats.mode & 64) > 0 && stats.uid === process.getuid()));
} }
// Get the path of cmd.exe in windows
function getCmdPath() {
var _a;
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
}
exports.getCmdPath = getCmdPath;
//# sourceMappingURL=io-util.js.map //# sourceMappingURL=io-util.js.map
/***/ }), /***/ }),
@@ -2224,6 +2363,25 @@ function isUnixExecutable(stats) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -2233,19 +2391,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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 })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
const assert_1 = __nccwpck_require__(2357);
const childProcess = __importStar(__nccwpck_require__(3129)); const childProcess = __importStar(__nccwpck_require__(3129));
const path = __importStar(__nccwpck_require__(5622)); const path = __importStar(__nccwpck_require__(5622));
const util_1 = __nccwpck_require__(1669); const util_1 = __nccwpck_require__(1669);
const ioUtil = __importStar(__nccwpck_require__(1962)); const ioUtil = __importStar(__nccwpck_require__(1962));
const exec = util_1.promisify(childProcess.exec); const exec = util_1.promisify(childProcess.exec);
const execFile = util_1.promisify(childProcess.execFile);
/** /**
* Copies a file or folder. * Copies a file or folder.
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -2256,14 +2410,14 @@ const exec = util_1.promisify(childProcess.exec);
*/ */
function cp(source, dest, options = {}) { function cp(source, dest, options = {}) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { force, recursive } = readCopyOptions(options); const { force, recursive, copySourceDirectory } = readCopyOptions(options);
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
// Dest is an existing file, but not forcing // Dest is an existing file, but not forcing
if (destStat && destStat.isFile() && !force) { if (destStat && destStat.isFile() && !force) {
return; return;
} }
// If dest is an existing directory, should copy inside. // If dest is an existing directory, should copy inside.
const newDest = destStat && destStat.isDirectory() const newDest = destStat && destStat.isDirectory() && copySourceDirectory
? path.join(dest, path.basename(source)) ? path.join(dest, path.basename(source))
: dest; : dest;
if (!(yield ioUtil.exists(source))) { if (!(yield ioUtil.exists(source))) {
@@ -2328,12 +2482,22 @@ function rmRF(inputPath) {
if (ioUtil.IS_WINDOWS) { 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 // 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. // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
// Check for invalid characters
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
if (/[*"<>|]/.test(inputPath)) {
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
}
try { try {
const cmdPath = ioUtil.getCmdPath();
if (yield ioUtil.isDirectory(inputPath, true)) { if (yield ioUtil.isDirectory(inputPath, true)) {
yield exec(`rd /s /q "${inputPath}"`); yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
env: { inputPath }
});
} }
else { else {
yield exec(`del /f /a "${inputPath}"`); yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
env: { inputPath }
});
} }
} }
catch (err) { catch (err) {
@@ -2366,7 +2530,7 @@ function rmRF(inputPath) {
return; return;
} }
if (isDir) { if (isDir) {
yield exec(`rm -rf "${inputPath}"`); yield execFile(`rm`, [`-rf`, `${inputPath}`]);
} }
else { else {
yield ioUtil.unlink(inputPath); yield ioUtil.unlink(inputPath);
@@ -2384,7 +2548,8 @@ exports.rmRF = rmRF;
*/ */
function mkdirP(fsPath) { function mkdirP(fsPath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield ioUtil.mkdirP(fsPath); assert_1.ok(fsPath, 'a path argument must be provided');
yield ioUtil.mkdir(fsPath, { recursive: true });
}); });
} }
exports.mkdirP = mkdirP; exports.mkdirP = mkdirP;
@@ -2482,7 +2647,10 @@ exports.findInPath = findInPath;
function readCopyOptions(options) { function readCopyOptions(options) {
const force = options.force == null ? true : options.force; const force = options.force == null ? true : options.force;
const recursive = Boolean(options.recursive); const recursive = Boolean(options.recursive);
return { force, recursive }; const copySourceDirectory = options.copySourceDirectory == null
? true
: Boolean(options.copySourceDirectory);
return { force, recursive, copySourceDirectory };
} }
function cpDirRecursive(sourceDir, destDir, currentDepth, force) { function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@@ -2543,6 +2711,25 @@ function copyFile(srcFile, destFile, force) {
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -2552,14 +2739,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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 })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
const semver = __importStar(__nccwpck_require__(562)); const semver = __importStar(__nccwpck_require__(562));
const core_1 = __nccwpck_require__(2186); const core_1 = __nccwpck_require__(2186);
// needs to be require for core node modules to be mocked // needs to be require for core node modules to be mocked
@@ -2628,8 +2809,13 @@ function _getOsVersion() {
const lines = lsbContents.split('\n'); const lines = lsbContents.split('\n');
for (const line of lines) { for (const line of lines) {
const parts = line.split('='); const parts = line.split('=');
if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') { if (parts.length === 2 &&
version = parts[1].trim(); (parts[0].trim() === 'VERSION_ID' ||
parts[0].trim() === 'DISTRIB_RELEASE')) {
version = parts[1]
.trim()
.replace(/^"/, '')
.replace(/"$/, '');
break; break;
} }
} }
@@ -2639,10 +2825,14 @@ function _getOsVersion() {
} }
exports._getOsVersion = _getOsVersion; exports._getOsVersion = _getOsVersion;
function _readLinuxVersionFile() { function _readLinuxVersionFile() {
const lsbFile = '/etc/lsb-release'; const lsbReleaseFile = '/etc/lsb-release';
const osReleaseFile = '/etc/os-release';
let contents = ''; let contents = '';
if (fs.existsSync(lsbFile)) { if (fs.existsSync(lsbReleaseFile)) {
contents = fs.readFileSync(lsbFile).toString(); contents = fs.readFileSync(lsbReleaseFile).toString();
}
else if (fs.existsSync(osReleaseFile)) {
contents = fs.readFileSync(osReleaseFile).toString();
} }
return contents; return contents;
} }
@@ -2656,6 +2846,25 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -2665,14 +2874,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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 })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RetryHelper = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
/** /**
* Internal class for retries * Internal class for retries
@@ -2733,6 +2936,25 @@ exports.RetryHelper = RetryHelper;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -2742,17 +2964,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); 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;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const io = __importStar(__nccwpck_require__(7436)); const io = __importStar(__nccwpck_require__(7436));
const fs = __importStar(__nccwpck_require__(5747)); const fs = __importStar(__nccwpck_require__(5747));
@@ -2784,9 +3000,10 @@ const userAgent = 'actions/tool-cache';
* @param url url of tool to download * @param url url of tool to download
* @param dest path to download tool * @param dest path to download tool
* @param auth authorization header * @param auth authorization header
* @param headers other headers
* @returns path to downloaded tool * @returns path to downloaded tool
*/ */
function downloadTool(url, dest, auth) { function downloadTool(url, dest, auth, headers) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
dest = dest || path.join(_getTempDirectory(), v4_1.default()); dest = dest || path.join(_getTempDirectory(), v4_1.default());
yield io.mkdirP(path.dirname(dest)); yield io.mkdirP(path.dirname(dest));
@@ -2797,7 +3014,7 @@ function downloadTool(url, dest, auth) {
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20); const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds); const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () { return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
return yield downloadToolAttempt(url, dest || '', auth); return yield downloadToolAttempt(url, dest || '', auth, headers);
}), (err) => { }), (err) => {
if (err instanceof HTTPError && err.httpStatusCode) { if (err instanceof HTTPError && err.httpStatusCode) {
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests // Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
@@ -2813,7 +3030,7 @@ function downloadTool(url, dest, auth) {
}); });
} }
exports.downloadTool = downloadTool; exports.downloadTool = downloadTool;
function downloadToolAttempt(url, dest, auth) { function downloadToolAttempt(url, dest, auth, headers) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (fs.existsSync(dest)) { if (fs.existsSync(dest)) {
throw new Error(`Destination file path ${dest} already exists`); throw new Error(`Destination file path ${dest} already exists`);
@@ -2822,12 +3039,12 @@ function downloadToolAttempt(url, dest, auth) {
const http = new httpm.HttpClient(userAgent, [], { const http = new httpm.HttpClient(userAgent, [], {
allowRetries: false allowRetries: false
}); });
let headers;
if (auth) { if (auth) {
core.debug('set auth'); core.debug('set auth');
headers = { if (headers === undefined) {
authorization: auth headers = {};
}; }
headers.authorization = auth;
} }
const response = yield http.get(url, headers); const response = yield http.get(url, headers);
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
@@ -2985,6 +3202,7 @@ function extractTar(file, dest, flags = 'xz') {
if (isGnuTar) { if (isGnuTar) {
// Suppress warnings when using GNU tar to extract archives created by BSD tar // Suppress warnings when using GNU tar to extract archives created by BSD tar
args.push('--warning=no-unknown-keyword'); args.push('--warning=no-unknown-keyword');
args.push('--overwrite');
} }
args.push('-C', destArg, '-f', fileArg); args.push('-C', destArg, '-f', fileArg);
yield exec_1.exec(`tar`, args); yield exec_1.exec(`tar`, args);
@@ -3050,20 +3268,50 @@ function extractZipWin(file, dest) {
// build the powershell command // build the powershell command
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines 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 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}')`; const pwshPath = yield io.which('pwsh', false);
// run powershell //To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
const powershellPath = yield io.which('powershell', true); //and the -Force flag for Expand-Archive as a fallback
const args = [ if (pwshPath) {
'-NoLogo', //attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
'-Sta', const pwshCommand = [
'-NoProfile', `$ErrorActionPreference = 'Stop' ;`,
'-NonInteractive', `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
'-ExecutionPolicy', `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
'Unrestricted', `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
'-Command', ].join(' ');
command const args = [
]; '-NoLogo',
yield exec_1.exec(`"${powershellPath}"`, args); '-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Unrestricted',
'-Command',
pwshCommand
];
core.debug(`Using pwsh at path: ${pwshPath}`);
yield exec_1.exec(`"${pwshPath}"`, args);
}
else {
const powershellCommand = [
`$ErrorActionPreference = 'Stop' ;`,
`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
].join(' ');
const args = [
'-NoLogo',
'-Sta',
'-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Unrestricted',
'-Command',
powershellCommand
];
const powershellPath = yield io.which('powershell', true);
core.debug(`Using powershell at path: ${powershellPath}`);
yield exec_1.exec(`"${powershellPath}"`, args);
}
}); });
} }
function extractZipNix(file, dest) { function extractZipNix(file, dest) {
@@ -3073,6 +3321,7 @@ function extractZipNix(file, dest) {
if (!core.isDebug()) { if (!core.isDebug()) {
args.unshift('-q'); args.unshift('-q');
} }
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest }); yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
}); });
} }
@@ -3155,9 +3404,9 @@ function find(toolName, versionSpec, arch) {
} }
arch = arch || os.arch(); arch = arch || os.arch();
// attempt to resolve an explicit version // attempt to resolve an explicit version
if (!_isExplicitVersion(versionSpec)) { if (!isExplicitVersion(versionSpec)) {
const localVersions = findAllVersions(toolName, arch); const localVersions = findAllVersions(toolName, arch);
const match = _evaluateVersions(localVersions, versionSpec); const match = evaluateVersions(localVersions, versionSpec);
versionSpec = match; versionSpec = match;
} }
// check for the explicit version in the cache // check for the explicit version in the cache
@@ -3190,7 +3439,7 @@ function findAllVersions(toolName, arch) {
if (fs.existsSync(toolPath)) { if (fs.existsSync(toolPath)) {
const children = fs.readdirSync(toolPath); const children = fs.readdirSync(toolPath);
for (const child of children) { for (const child of children) {
if (_isExplicitVersion(child)) { if (isExplicitVersion(child)) {
const fullPath = path.join(toolPath, child, arch || ''); const fullPath = path.join(toolPath, child, arch || '');
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) { if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
versions.push(child); versions.push(child);
@@ -3273,14 +3522,26 @@ function _completeToolPath(tool, version, arch) {
fs.writeFileSync(markerPath, ''); fs.writeFileSync(markerPath, '');
core.debug('finished caching tool'); core.debug('finished caching tool');
} }
function _isExplicitVersion(versionSpec) { /**
* Check if version string is explicit
*
* @param versionSpec version string to check
*/
function isExplicitVersion(versionSpec) {
const c = semver.clean(versionSpec) || ''; const c = semver.clean(versionSpec) || '';
core.debug(`isExplicit: ${c}`); core.debug(`isExplicit: ${c}`);
const valid = semver.valid(c) != null; const valid = semver.valid(c) != null;
core.debug(`explicit? ${valid}`); core.debug(`explicit? ${valid}`);
return valid; return valid;
} }
function _evaluateVersions(versions, versionSpec) { exports.isExplicitVersion = isExplicitVersion;
/**
* Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
*
* @param versions array of versions to evaluate
* @param versionSpec semantic version spec to satisfy
*/
function evaluateVersions(versions, versionSpec) {
let version = ''; let version = '';
core.debug(`evaluating ${versions.length} versions`); core.debug(`evaluating ${versions.length} versions`);
versions = versions.sort((a, b) => { versions = versions.sort((a, b) => {
@@ -3305,6 +3566,7 @@ function _evaluateVersions(versions, versionSpec) {
} }
return version; return version;
} }
exports.evaluateVersions = evaluateVersions;
/** /**
* Gets RUNNER_TOOL_CACHE * Gets RUNNER_TOOL_CACHE
*/ */
@@ -8456,6 +8718,22 @@ module.exports = require("stream");;
/***/ }), /***/ }),
/***/ 4304:
/***/ ((module) => {
"use strict";
module.exports = require("string_decoder");;
/***/ }),
/***/ 8213:
/***/ ((module) => {
"use strict";
module.exports = require("timers");;
/***/ }),
/***/ 4016: /***/ 4016:
/***/ ((module) => { /***/ ((module) => {

74
package-lock.json generated
View File

@@ -5,14 +5,14 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.2.7", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.7.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.4.0.tgz",
"integrity": "sha512-kzLFD5BgEvq6ubcxdgPbRKGD2Qrgya/5j+wh4LZzqT915I0V3rED+MvjH6NXghbvk1MXknpNNQ3uKjXSEN00Ig==" "integrity": "sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg=="
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.4", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz",
"integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", "integrity": "sha512-LImpN9AY0J1R1mEYJjVJfSZWU4zYOlEcwSTgPve1rFQqK5AwrEs6uWW5Rv70gbDIQIAUwI86z6B+9mPK4w9Sbg==",
"requires": { "requires": {
"@actions/io": "^1.0.1" "@actions/io": "^1.0.1"
} }
@@ -26,19 +26,19 @@
} }
}, },
"@actions/io": { "@actions/io": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.1.tgz",
"integrity": "sha512-PspSX7Z9zh2Fyyuf3F6BsYeXcYHfc/VJ1vwy2vouas95efHVd42M6UfBFRs+jY0uiMDXhAoUtATn9g2r1MaWBQ==" "integrity": "sha512-Qi4JoKXjmE0O67wAOH6y0n26QXhMKMFo7GD/4IXNVcrtLjUlGjGuVys6pQgwF3ArfGTQu0XpqaNr0YhED2RaRA=="
}, },
"@actions/tool-cache": { "@actions/tool-cache": {
"version": "1.6.1", "version": "1.7.1",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.6.1.tgz", "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.7.1.tgz",
"integrity": "sha512-F+vwEDwfqcHMKuSkj79pihOnsAMv23EkG76nMpc82UsnXwyQdyEsktGxrB0SNtm7pRqTXEIOoAPTgrSQclXYTg==", "integrity": "sha512-y1xxxOhXaBUIUit3lhepmu/0xdgiTMpnZRLmVdtF0hTm521doi+MdRRRP62czHvM7wxH6epj4JPNJQ3iJpOrkQ==",
"requires": { "requires": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.0", "@actions/exec": "^1.0.0",
"@actions/http-client": "^1.0.8", "@actions/http-client": "^1.0.8",
"@actions/io": "^1.0.1", "@actions/io": "^1.1.1",
"semver": "^6.1.0", "semver": "^6.1.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
@@ -1049,9 +1049,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "14.14.41", "version": "14.17.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.3.tgz",
"integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==", "integrity": "sha512-e6ZowgGJmTuXa3GyaPbTGxX17tnThl2aSSizrFthQ7m9uLGZBXiGhgE55cjRZTF5kjZvYn9EOPOMljdjwbflxw==",
"dev": true "dev": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
@@ -1067,9 +1067,9 @@
"dev": true "dev": true
}, },
"@types/semver": { "@types/semver": {
"version": "7.3.5", "version": "7.3.6",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.5.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.6.tgz",
"integrity": "sha512-iotVxtCCsPLRAvxMFFgxL8HD2l4mAZ2Oin7/VJ2ooWO0VOK4EGOGmZWZn1uCq7RofR3I/1IOSjCHlFT71eVK0Q==", "integrity": "sha512-0caWDWmpCp0uifxFh+FaqK3CuZ2SkRR/ZRxAV5+zNdC3QVUi6wyOJnefhPvtNt8NQWXB5OA93BUvZsXpWat2Xw==",
"dev": true "dev": true
}, },
"@types/stack-utils": { "@types/stack-utils": {
@@ -1100,9 +1100,9 @@
"dev": true "dev": true
}, },
"@vercel/ncc": { "@vercel/ncc": {
"version": "0.28.3", "version": "0.28.6",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.28.3.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.28.6.tgz",
"integrity": "sha512-g3gk4D9itbhUQa5MtN7TOdeoQnNLkPDCox5SBaQ/H3Or5lo59TOaZWrLb+x47StiAJ+8DXZS/9MJ67cIBWSsRw==", "integrity": "sha512-t4BoSSuyK8BZaUE0gV18V6bkFs4st7baumtFGa50dv1tMu2GDBEBF8sUZaKBdKiL6DzJ2D2+XVCwYWWDcQOYdQ==",
"dev": true "dev": true
}, },
"abab": { "abab": {
@@ -2491,9 +2491,9 @@
} }
}, },
"hosted-git-info": { "hosted-git-info": {
"version": "2.7.1", "version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true "dev": true
}, },
"html-encoding-sniffer": { "html-encoding-sniffer": {
@@ -4610,9 +4610,9 @@
"dev": true "dev": true
}, },
"nock": { "nock": {
"version": "13.0.11", "version": "13.1.0",
"resolved": "https://registry.npmjs.org/nock/-/nock-13.0.11.tgz", "resolved": "https://registry.npmjs.org/nock/-/nock-13.1.0.tgz",
"integrity": "sha512-sKZltNkkWblkqqPAsjYW0bm3s9DcHRPiMOyKO/PkfJ+ANHZ2+LA2PLe22r4lLrKgXaiSaDQwW3qGsJFtIpQIeQ==", "integrity": "sha512-3N3DUY8XYrxxzWazQ+nSBpiaJ3q6gcpNh4gXovC/QBxrsvNp4tq+wsLHF6mJ3nrn3lPLn7KCJqKxy/9aD+0fdw==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.0", "debug": "^4.1.0",
@@ -6098,9 +6098,9 @@
} }
}, },
"ts-jest": { "ts-jest": {
"version": "26.5.5", "version": "26.5.6",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.5.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.6.tgz",
"integrity": "sha512-7tP4m+silwt1NHqzNRAPjW1BswnAhopTdc2K3HEkRZjF0ZG2F/e/ypVH0xiZIMfItFtD3CX0XFbwPzp9fIEUVg==", "integrity": "sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==",
"dev": true, "dev": true,
"requires": { "requires": {
"bs-logger": "0.x", "bs-logger": "0.x",
@@ -6174,9 +6174,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "4.2.4", "version": "4.3.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz",
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", "integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==",
"dev": true "dev": true
}, },
"union-value": { "union-value": {
@@ -6439,9 +6439,9 @@
} }
}, },
"ws": { "ws": {
"version": "7.4.5", "version": "7.4.6",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==", "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
"dev": true "dev": true
}, },
"xml-name-validator": { "xml-name-validator": {

View File

@@ -25,27 +25,27 @@
"author": "Alif Rachmawadi <arch@subosito.com>", "author": "Alif Rachmawadi <arch@subosito.com>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.7", "@actions/core": "^1.4.0",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.1.0",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@actions/io": "^1.1.0", "@actions/io": "^1.1.1",
"@actions/tool-cache": "^1.6.1", "@actions/tool-cache": "^1.7.1",
"semver": "^7.3.5", "semver": "^7.3.5",
"uuid": "^8.3.2" "uuid": "^8.3.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.23", "@types/jest": "^26.0.23",
"@types/node": "^14.14.41", "@types/node": "^14.17.3",
"@types/semver": "^7.3.5", "@types/semver": "^7.3.6",
"@types/uuid": "^8.3.0", "@types/uuid": "^8.3.0",
"@vercel/ncc": "^0.28.3", "@vercel/ncc": "^0.28.6",
"jest": "^26.6.3", "jest": "^26.6.3",
"jest-circus": "^26.6.3", "jest-circus": "^26.6.3",
"nock": "^13.0.11", "nock": "^13.1.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "1.19.1", "prettier": "1.19.1",
"ts-jest": "^26.5.5", "ts-jest": "^26.5.6",
"typescript": "^4.2.4" "typescript": "^4.3.2"
}, },
"resolutions": { "resolutions": {
"minimist": "^1.2.2" "minimist": "^1.2.2"

View File

@@ -46,9 +46,17 @@ export async function getFlutter(
} }
core.exportVariable('FLUTTER_ROOT', toolPath); core.exportVariable('FLUTTER_ROOT', toolPath);
let pubCachePath = process.env['PUB_CACHE'] || '';
if (!pubCachePath) {
pubCachePath = path.join(toolPath, '.pub-cache');
core.exportVariable('PUB_CACHE', pubCachePath);
}
core.addPath(path.join(toolPath, 'bin')); core.addPath(path.join(toolPath, 'bin'));
core.addPath(path.join(toolPath, 'bin', 'cache', 'dart-sdk', 'bin')); core.addPath(path.join(toolPath, 'bin', 'cache', 'dart-sdk', 'bin'));
core.addPath(path.join(toolPath, '.pub-cache', 'bin')); core.addPath(path.join(pubCachePath, 'bin'));
if (useMaster) { if (useMaster) {
await exec.exec('flutter', ['channel', 'master']); await exec.exec('flutter', ['channel', 'master']);