Use native tools

This commit is contained in:
CrazyMax
2020-05-06 22:14:50 +02:00
parent 232b78f307
commit 6395a3aa2f
6 changed files with 75 additions and 875 deletions

View File

@@ -1,10 +1,10 @@
import * as installer from './installer';
import * as fs from 'fs';
import * as os from 'os';
import * as installer from './installer';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
export async function run(silent?: boolean) {
export async function run() {
try {
if (os.platform() == 'darwin') {
core.setFailed('Not supported on darwin platform');
@@ -14,16 +14,16 @@ export async function run(silent?: boolean) {
const version = core.getInput('version') || 'latest';
const file = core.getInput('file', {required: true});
const args = core.getInput('args');
const upx = await installer.getUPX(version);
if (!fs.existsSync(file)) {
core.setFailed(`File to compress not found: ${file}`);
core.setFailed(`File to compress not found: ${file}`);
return;
}
console.log('🏃 Running UPX...');
await exec.exec(`${upx} ${args} ${file}`, undefined, {
silent: silent
});
const upx = await installer.getUPX(version);
core.info('🏃 Running UPX...');
await exec.exec(`${upx} ${args} ${file}`);
} catch (error) {
core.setFailed(error.message);
}