mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2025-12-09 22:40:42 -07:00
Update node_modules
This commit is contained in:
@@ -16,14 +16,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const decompress = require("decompress");
|
||||
const decompresstarxz = require("decompress-tarxz");
|
||||
const download = __importStar(require("download"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const util = __importStar(require("util"));
|
||||
const restm = __importStar(require("typed-rest-client/RestClient"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
let osPlat = os.platform();
|
||||
let osArch = os.arch();
|
||||
function getUPX(version) {
|
||||
@@ -32,24 +32,29 @@ function getUPX(version) {
|
||||
if (selected) {
|
||||
version = selected;
|
||||
}
|
||||
console.log(`✅ UPX version found: ${version}`);
|
||||
core.info(`✅ UPX version found: ${version}`);
|
||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'upx-'));
|
||||
const fileName = getFileName(version);
|
||||
const downloadUrl = util.format('https://github.com/upx/upx/releases/download/v%s/%s', version, fileName);
|
||||
console.log(`⬇️ Downloading ${downloadUrl}...`);
|
||||
core.info(`⬇️ Downloading ${downloadUrl}...`);
|
||||
yield download.default(downloadUrl, tmpdir, { filename: fileName });
|
||||
console.log('📦 Extracting UPX...');
|
||||
core.info('📦 Extracting UPX...');
|
||||
let extPath = tmpdir;
|
||||
if (osPlat == 'win32') {
|
||||
yield decompress(`${tmpdir}/${fileName}`, tmpdir, { strip: 1 });
|
||||
extPath = yield tc.extractZip(`${tmpdir}/${fileName}`);
|
||||
}
|
||||
else {
|
||||
yield decompresstarxz(`${tmpdir}/${fileName}`, tmpdir, { strip: 1 });
|
||||
extPath = yield tc.extractTar(`${tmpdir}/${fileName}`, undefined, 'x');
|
||||
}
|
||||
return path.join(tmpdir, osPlat == 'win32' ? 'upx.exe' : 'upx');
|
||||
return path.join(extPath, getFileNameWithoutExt(version), osPlat == 'win32' ? 'upx.exe' : 'upx');
|
||||
});
|
||||
}
|
||||
exports.getUPX = getUPX;
|
||||
function getFileName(version) {
|
||||
const ext = osPlat == 'win32' ? 'zip' : 'tar.xz';
|
||||
return util.format('%s.%s', getFileNameWithoutExt(version), ext);
|
||||
}
|
||||
function getFileNameWithoutExt(version) {
|
||||
let platform = '';
|
||||
if (osPlat == 'win32') {
|
||||
platform = osArch == 'x64' ? 'win64' : 'win32';
|
||||
@@ -57,8 +62,7 @@ function getFileName(version) {
|
||||
else if (osPlat == 'linux') {
|
||||
platform = osArch == 'x64' ? 'amd64_linux' : 'i386_linux';
|
||||
}
|
||||
const ext = osPlat == 'win32' ? 'zip' : 'tar.xz';
|
||||
return util.format('upx-%s-%s.%s', version, platform, ext);
|
||||
return util.format('upx-%s-%s', version, platform);
|
||||
}
|
||||
function determineVersion(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
||||
@@ -18,11 +18,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const installer = __importStar(require("./installer"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
function run(silent) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
if (os.platform() == 'darwin') {
|
||||
core.setFailed('Not supported on darwin platform');
|
||||
return;
|
||||
}
|
||||
const version = core.getInput('version') || 'latest';
|
||||
const file = core.getInput('file', { required: true });
|
||||
const args = core.getInput('args');
|
||||
|
||||
Reference in New Issue
Block a user