feat: install-only

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2023-05-02 22:44:03 -03:00
parent 48ab6ba97a
commit dbf74e34eb
7 changed files with 48 additions and 6 deletions

View File

@@ -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')
};
}

View File

@@ -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.`);