mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2026-04-17 03:52:59 -06:00
Use native tools
This commit is contained in:
16
src/main.ts
16
src/main.ts
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user