Merge pull request #201 from caarlos0/install-only

feat: install-only
This commit is contained in:
CrazyMax 2023-05-03 17:32:15 +02:00 committed by GitHub
commit 15e7963e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 6 deletions

View File

@ -50,3 +50,29 @@ jobs:
files: |
./bin/firefox-history-merger*
args: -fq
install-only:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
version:
- latest
- v4.0.2
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: UPX
uses: ./
with:
version: ${{ matrix.version }}
install-only: true
-
name: verify
run: |
which upx
upx --version

View File

@ -54,8 +54,9 @@ Following inputs can be used as `step.with` keys
| Name | Type | Default | Description |
|---------------|---------|-----------|---------------------------------|
| `version` | String | `latest` | UPX version. Example: `v3.95` |
| `files` | String | | Newline-delimited list of path globs for files to compress (**required**) |
| `files` | String | | Newline-delimited list of path globs for files to compress |
| `args` | String | | Arguments to pass to UPX |
| `install-only` | String | `false` | Install upx, but do not run it |
## Limitation

View File

@ -21,6 +21,11 @@ inputs:
deprecationMessage: 'file is deprecated. Please use files input instead.'
description: 'File to compress'
required: false
install-only:
description: 'Just install upx'
default: 'false'
required: false
runs:
using: 'node16'

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

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