mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2025-12-09 14:30:42 -07:00
feat: install-only
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
@@ -6,13 +6,15 @@ export interface Inputs {
|
||||
version: string;
|
||||
files: string[];
|
||||
args: string;
|
||||
installOnly: boolean;
|
||||
}
|
||||
|
||||
export async function getInputs(): Promise<Inputs> {
|
||||
return {
|
||||
version: core.getInput('version') || 'latest',
|
||||
files: getInputList(core.getInput('files') || core.getInput('file'), true),
|
||||
args: core.getInput('args')
|
||||
args: core.getInput('args'),
|
||||
installOnly: core.getBooleanInput('install-only')
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as context from './context';
|
||||
import * as installer from './installer';
|
||||
import * as core from '@actions/core';
|
||||
@@ -14,6 +15,13 @@ async function run(): Promise<void> {
|
||||
const inputs: context.Inputs = await context.getInputs();
|
||||
const upx = await installer.getUPX(inputs.version);
|
||||
|
||||
if (inputs.installOnly) {
|
||||
const dir = path.dirname(upx);
|
||||
core.addPath(dir);
|
||||
core.debug(`Added ${dir} to PATH`);
|
||||
return;
|
||||
}
|
||||
|
||||
const files: string[] = context.resolvePaths(inputs.files);
|
||||
if (files.length == 0) {
|
||||
core.warning(`No files were found. Please check the 'files' input.`);
|
||||
|
||||
Reference in New Issue
Block a user