mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2024-11-21 18:06:08 -07:00
feat: install-only
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
48ab6ba97a
commit
dbf74e34eb
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -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.`);
|
||||
|
|
Loading…
Reference in New Issue
Block a user