mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2024-11-24 11:16:08 -07:00
Update generated content
This commit is contained in:
parent
baf9dbcb82
commit
cbee808295
207
dist/index.js
generated
vendored
207
dist/index.js
generated
vendored
|
@ -19,7 +19,13 @@ module.exports =
|
|||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/ var threw = true;
|
||||
/******/ try {
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/ threw = false;
|
||||
/******/ } finally {
|
||||
/******/ if(threw) delete installedModules[moduleId];
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
|
@ -954,6 +960,119 @@ module.exports = require("tls");
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 31:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
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) : adopt(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 });
|
||||
const semver = __importStar(__webpack_require__(280));
|
||||
const core_1 = __webpack_require__(470);
|
||||
// needs to be require for core node modules to be mocked
|
||||
/* eslint @typescript-eslint/no-require-imports: 0 */
|
||||
const os = __webpack_require__(87);
|
||||
const cp = __webpack_require__(129);
|
||||
const fs = __webpack_require__(747);
|
||||
function _findMatch(versionSpec, stable, candidates, archFilter) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const platFilter = os.platform();
|
||||
let result;
|
||||
let match;
|
||||
let file;
|
||||
for (const candidate of candidates) {
|
||||
const version = candidate.version;
|
||||
core_1.debug(`check ${version} satisfies ${versionSpec}`);
|
||||
if (semver.satisfies(version, versionSpec) &&
|
||||
(!stable || candidate.stable === stable)) {
|
||||
file = candidate.files.find(item => {
|
||||
core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
|
||||
let chk = item.arch === archFilter && item.platform === platFilter;
|
||||
if (chk && item.platform_version) {
|
||||
const osVersion = module.exports._getOsVersion();
|
||||
if (osVersion === item.platform_version) {
|
||||
chk = true;
|
||||
}
|
||||
else {
|
||||
chk = semver.satisfies(osVersion, item.platform_version);
|
||||
}
|
||||
}
|
||||
return chk;
|
||||
});
|
||||
if (file) {
|
||||
core_1.debug(`matched ${candidate.version}`);
|
||||
match = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (match && file) {
|
||||
// clone since we're mutating the file list to be only the file that matches
|
||||
result = Object.assign({}, match);
|
||||
result.files = [file];
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
exports._findMatch = _findMatch;
|
||||
function _getOsVersion() {
|
||||
// TODO: add windows and other linux, arm variants
|
||||
// right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python)
|
||||
const plat = os.platform();
|
||||
let version = '';
|
||||
if (plat === 'darwin') {
|
||||
version = cp.execSync('sw_vers -productVersion').toString();
|
||||
}
|
||||
else if (plat === 'linux') {
|
||||
// lsb_release process not in some containers, readfile
|
||||
// Run cat /etc/lsb-release
|
||||
// DISTRIB_ID=Ubuntu
|
||||
// DISTRIB_RELEASE=18.04
|
||||
// DISTRIB_CODENAME=bionic
|
||||
// DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
|
||||
const lsbContents = module.exports._readLinuxVersionFile();
|
||||
if (lsbContents) {
|
||||
const lines = lsbContents.split('\n');
|
||||
for (const line of lines) {
|
||||
const parts = line.split('=');
|
||||
if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') {
|
||||
version = parts[1].trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
exports._getOsVersion = _getOsVersion;
|
||||
function _readLinuxVersionFile() {
|
||||
const lsbFile = '/etc/lsb-release';
|
||||
let contents = '';
|
||||
if (fs.existsSync(lsbFile)) {
|
||||
contents = fs.readFileSync(lsbFile).toString();
|
||||
}
|
||||
return contents;
|
||||
}
|
||||
exports._readLinuxVersionFile = _readLinuxVersionFile;
|
||||
//# sourceMappingURL=manifest.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 87:
|
||||
/***/ (function(module) {
|
||||
|
||||
|
@ -3310,6 +3429,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const core = __importStar(__webpack_require__(470));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const mm = __importStar(__webpack_require__(31));
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const httpm = __importStar(__webpack_require__(539));
|
||||
|
@ -3335,9 +3455,10 @@ const userAgent = 'actions/tool-cache';
|
|||
*
|
||||
* @param url url of tool to download
|
||||
* @param dest path to download tool
|
||||
* @param auth authorization header
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
function downloadTool(url, dest) {
|
||||
function downloadTool(url, dest, auth) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
||||
yield io.mkdirP(path.dirname(dest));
|
||||
|
@ -3348,7 +3469,7 @@ function downloadTool(url, dest) {
|
|||
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
||||
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
||||
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||
return yield downloadToolAttempt(url, dest || '');
|
||||
return yield downloadToolAttempt(url, dest || '', auth);
|
||||
}), (err) => {
|
||||
if (err instanceof HTTPError && err.httpStatusCode) {
|
||||
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
||||
|
@ -3364,7 +3485,7 @@ function downloadTool(url, dest) {
|
|||
});
|
||||
}
|
||||
exports.downloadTool = downloadTool;
|
||||
function downloadToolAttempt(url, dest) {
|
||||
function downloadToolAttempt(url, dest, auth) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (fs.existsSync(dest)) {
|
||||
throw new Error(`Destination file path ${dest} already exists`);
|
||||
|
@ -3373,7 +3494,14 @@ function downloadToolAttempt(url, dest) {
|
|||
const http = new httpm.HttpClient(userAgent, [], {
|
||||
allowRetries: false
|
||||
});
|
||||
const response = yield http.get(url);
|
||||
let headers;
|
||||
if (auth) {
|
||||
core.debug('set auth');
|
||||
headers = {
|
||||
authorization: auth
|
||||
};
|
||||
}
|
||||
const response = yield http.get(url, headers);
|
||||
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})`);
|
||||
|
@ -3428,9 +3556,10 @@ function extract7z(file, dest, _7zPath) {
|
|||
process.chdir(dest);
|
||||
if (_7zPath) {
|
||||
try {
|
||||
const logLevel = core.isDebug() ? '-bb1' : '-bb0';
|
||||
const args = [
|
||||
'x',
|
||||
'-bb1',
|
||||
logLevel,
|
||||
'-bd',
|
||||
'-sccUTF-8',
|
||||
file
|
||||
|
@ -3506,7 +3635,16 @@ function extractTar(file, dest, flags = 'xz') {
|
|||
core.debug(versionOutput.trim());
|
||||
const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
|
||||
// Initialize args
|
||||
const args = [flags];
|
||||
let args;
|
||||
if (flags instanceof Array) {
|
||||
args = flags;
|
||||
}
|
||||
else {
|
||||
args = [flags];
|
||||
}
|
||||
if (core.isDebug() && !flags.includes('v')) {
|
||||
args.push('-v');
|
||||
}
|
||||
let destArg = dest;
|
||||
let fileArg = file;
|
||||
if (IS_WINDOWS && isGnuTar) {
|
||||
|
@ -3556,7 +3694,7 @@ function extractZipWin(file, dest) {
|
|||
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 powershellPath = yield io.which('powershell', true);
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
|
@ -3572,8 +3710,12 @@ function extractZipWin(file, dest) {
|
|||
}
|
||||
function extractZipNix(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = yield io.which('unzip');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
const unzipPath = yield io.which('unzip', true);
|
||||
const args = [file];
|
||||
if (!core.isDebug()) {
|
||||
args.unshift('-q');
|
||||
}
|
||||
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -3701,6 +3843,51 @@ function findAllVersions(toolName, arch) {
|
|||
return versions;
|
||||
}
|
||||
exports.findAllVersions = findAllVersions;
|
||||
function getManifestFromRepo(owner, repo, auth, branch = 'master') {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let releases = [];
|
||||
const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`;
|
||||
const http = new httpm.HttpClient('tool-cache');
|
||||
const headers = {};
|
||||
if (auth) {
|
||||
core.debug('set auth');
|
||||
headers.authorization = auth;
|
||||
}
|
||||
const response = yield http.getJson(treeUrl, headers);
|
||||
if (!response.result) {
|
||||
return releases;
|
||||
}
|
||||
let manifestUrl = '';
|
||||
for (const item of response.result.tree) {
|
||||
if (item.path === 'versions-manifest.json') {
|
||||
manifestUrl = item.url;
|
||||
break;
|
||||
}
|
||||
}
|
||||
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
||||
let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
|
||||
if (versionsRaw) {
|
||||
// shouldn't be needed but protects against invalid json saved with BOM
|
||||
versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
|
||||
try {
|
||||
releases = JSON.parse(versionsRaw);
|
||||
}
|
||||
catch (_a) {
|
||||
core.debug('Invalid json');
|
||||
}
|
||||
}
|
||||
return releases;
|
||||
});
|
||||
}
|
||||
exports.getManifestFromRepo = getManifestFromRepo;
|
||||
function findFromManifest(versionSpec, stable, manifest, archFilter = os.arch()) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// wrap the internal impl
|
||||
const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
|
||||
return match;
|
||||
});
|
||||
}
|
||||
exports.findFromManifest = findFromManifest;
|
||||
function _createExtractFolder(dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!dest) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user