mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2026-04-17 03:52:59 -06:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ea5068f0f | ||
|
|
d2071be44b | ||
|
|
4c4869581a | ||
|
|
8e8e4b8c59 | ||
|
|
03544b5b3e | ||
|
|
1412a4b386 | ||
|
|
58600ce61a | ||
|
|
e163ff0d2e | ||
|
|
3b3d2b898d | ||
|
|
88a78e2f11 | ||
|
|
6837697d11 | ||
|
|
5cc6b8eb5b | ||
|
|
f1338960fb | ||
|
|
0569f84afe | ||
|
|
4258956a57 |
46
.github/workflows/automerge.yml
vendored
Normal file
46
.github/workflows/automerge.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: automerge
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
- unlabeled
|
||||||
|
- synchronize
|
||||||
|
- unlocked
|
||||||
|
check_suite:
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
status: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependabot:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Approve
|
||||||
|
uses: actions/github-script@0.9.0
|
||||||
|
with:
|
||||||
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
script: |
|
||||||
|
await github.pulls.createReview({
|
||||||
|
owner: context.payload.repository.owner.login,
|
||||||
|
repo: context.payload.repository.name,
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
event: 'APPROVE'
|
||||||
|
})
|
||||||
|
-
|
||||||
|
name: Wait
|
||||||
|
run: sleep 3
|
||||||
|
-
|
||||||
|
name: Merge
|
||||||
|
uses: actions/github-script@0.9.0
|
||||||
|
with:
|
||||||
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
script: |
|
||||||
|
await github.pulls.merge({
|
||||||
|
owner: context.payload.repository.owner.login,
|
||||||
|
repo: context.payload.repository.name,
|
||||||
|
pull_number: context.payload.pull_request.number,
|
||||||
|
merge_method: 'squash'
|
||||||
|
})
|
||||||
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -17,12 +17,13 @@ jobs:
|
|||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
|
version:
|
||||||
|
- latest
|
||||||
|
- v3.95
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
|
||||||
file: https://github.com/crazy-max/firefox-history-merger/releases/download/2.4.0/firefox-history-merger-linux-amd64
|
file: https://github.com/crazy-max/firefox-history-merger/releases/download/2.4.0/firefox-history-merger-linux-amd64
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: latest
|
|
||||||
file: https://github.com/crazy-max/firefox-history-merger/releases/download/2.4.0/firefox-history-merger-windows-4.0-amd64.exe
|
file: https://github.com/crazy-max/firefox-history-merger/releases/download/2.4.0/firefox-history-merger-windows-4.0-amd64.exe
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
|
|||||||
2
.github/workflows/labels.yml
vendored
2
.github/workflows/labels.yml
vendored
@@ -13,11 +13,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
# https://github.com/actions/checkout
|
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
# https://github.com/crazy-max/ghaction-github-labeler
|
|
||||||
name: Run Labeler
|
name: Run Labeler
|
||||||
if: success()
|
if: success()
|
||||||
uses: crazy-max/ghaction-github-labeler@v2
|
uses: crazy-max/ghaction-github-labeler@v2
|
||||||
|
|||||||
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -11,11 +11,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
# https://github.com/actions/checkout
|
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
# https://github.com/actions/setup-node
|
|
||||||
name: Set up Node
|
name: Set up Node
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
-
|
-
|
||||||
|
|||||||
1
.github/workflows/master.yml
vendored
1
.github/workflows/master.yml
vendored
@@ -10,7 +10,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
# https://github.com/actions/checkout
|
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
|
|||||||
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@@ -19,25 +19,15 @@ jobs:
|
|||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
# https://github.com/actions/checkout
|
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
-
|
-
|
||||||
name: Install
|
name: Install
|
||||||
run: npm ci
|
run: npm install
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
run: npm run build
|
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: npm run test
|
run: npm run test
|
||||||
-
|
-
|
||||||
# https://github.com/codecov/codecov-action
|
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
if: success()
|
if: success()
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.3.2 (2020/05/11)
|
||||||
|
|
||||||
|
* Update README
|
||||||
|
|
||||||
|
## 1.3.1 (2020/05/07)
|
||||||
|
|
||||||
|
* Code cleanup
|
||||||
|
|
||||||
## 1.3.0 (2020/05/06)
|
## 1.3.0 (2020/05/06)
|
||||||
|
|
||||||
* Use native tools
|
* Use native tools
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ jobs:
|
|||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|---------------|---------|-----------|-------------------------------|
|
|---------------|---------|-----------|---------------------------------|
|
||||||
| `version` | String | `latest` | UPX version. Example: `3.95` |
|
| `version` | String | `latest` | UPX version. Example: `v3.95` |
|
||||||
| `file` | String | | File to compress |
|
| `file` | String | | File to compress (**required**) |
|
||||||
| `args` | String | | Arguments to pass to UPX |
|
| `args` | String | | Arguments to pass to UPX |
|
||||||
|
|
||||||
## Limitation
|
## Limitation
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
import * as github from '../src/github';
|
import * as github from '../src/github';
|
||||||
|
|
||||||
describe('github', () => {
|
describe('github', () => {
|
||||||
it('returns 3.96 GitHub release', async () => {
|
it('returns latest UPX GitHub release', async () => {
|
||||||
const release = await github.getRelease('3.96');
|
const release = await github.getRelease('latest');
|
||||||
|
console.log(release);
|
||||||
|
expect(release).not.toBeNull();
|
||||||
|
expect(release?.tag_name).not.toEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns v3.96 GoReleaser GitHub release', async () => {
|
||||||
|
const release = await github.getRelease('v3.96');
|
||||||
|
console.log(release);
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).toEqual('v3.96');
|
expect(release?.tag_name).toEqual('v3.96');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ import fs = require('fs');
|
|||||||
import * as installer from '../src/installer';
|
import * as installer from '../src/installer';
|
||||||
|
|
||||||
describe('installer', () => {
|
describe('installer', () => {
|
||||||
it('acquires 3.95 version of UPX', async () => {
|
it('acquires v3.95 version of UPX', async () => {
|
||||||
const upx = await installer.getUPX('3.95');
|
const upx = await installer.getUPX('v3.95');
|
||||||
|
console.log(upx);
|
||||||
expect(fs.existsSync(upx)).toBe(true);
|
expect(fs.existsSync(upx)).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
it('acquires latest version of UPX', async () => {
|
it('acquires latest version of UPX', async () => {
|
||||||
const upx = await installer.getUPX('latest');
|
const upx = await installer.getUPX('latest');
|
||||||
|
console.log(upx);
|
||||||
expect(fs.existsSync(upx)).toBe(true);
|
expect(fs.existsSync(upx)).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ inputs:
|
|||||||
version:
|
version:
|
||||||
description: 'UPX version. Example: 3.95'
|
description: 'UPX version. Example: 3.95'
|
||||||
default: 'latest'
|
default: 'latest'
|
||||||
|
required: false
|
||||||
file:
|
file:
|
||||||
description: 'File to compress'
|
description: 'File to compress'
|
||||||
required: true
|
required: true
|
||||||
args:
|
args:
|
||||||
description: 'Arguments to pass to UPX'
|
description: 'Arguments to pass to UPX'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
|||||||
18
dist/index.js
generated
vendored
18
dist/index.js
generated
vendored
@@ -1305,7 +1305,6 @@ function run() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.run = run;
|
|
||||||
run();
|
run();
|
||||||
//# sourceMappingURL=main.js.map
|
//# sourceMappingURL=main.js.map
|
||||||
|
|
||||||
@@ -4620,8 +4619,8 @@ const util = __importStar(__webpack_require__(669));
|
|||||||
const github = __importStar(__webpack_require__(824));
|
const github = __importStar(__webpack_require__(824));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const tc = __importStar(__webpack_require__(533));
|
const tc = __importStar(__webpack_require__(533));
|
||||||
let osPlat = os.platform();
|
const osPlat = os.platform();
|
||||||
let osArch = os.arch();
|
const osArch = os.arch();
|
||||||
function getUPX(version) {
|
function getUPX(version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const release = yield github.getRelease(version);
|
const release = yield github.getRelease(version);
|
||||||
@@ -4629,7 +4628,6 @@ function getUPX(version) {
|
|||||||
throw new Error(`Cannot find UPX ${version} release`);
|
throw new Error(`Cannot find UPX ${version} release`);
|
||||||
}
|
}
|
||||||
const semver = release.tag_name.replace(/^v/, '');
|
const semver = release.tag_name.replace(/^v/, '');
|
||||||
core.debug(`Semver is ${semver}`);
|
|
||||||
core.info(`✅ UPX version found: ${semver}`);
|
core.info(`✅ UPX version found: ${semver}`);
|
||||||
const filename = util.format('%s.%s', getName(semver), osPlat == 'win32' ? 'zip' : 'tar.xz');
|
const filename = util.format('%s.%s', getName(semver), osPlat == 'win32' ? 'zip' : 'tar.xz');
|
||||||
const downloadUrl = util.format('https://github.com/upx/upx/releases/download/v%s/%s', semver, filename);
|
const downloadUrl = util.format('https://github.com/upx/upx/releases/download/v%s/%s', semver, filename);
|
||||||
@@ -4637,9 +4635,15 @@ function getUPX(version) {
|
|||||||
const downloadPath = yield tc.downloadTool(downloadUrl);
|
const downloadPath = yield tc.downloadTool(downloadUrl);
|
||||||
core.debug(`Downloaded to ${downloadPath}`);
|
core.debug(`Downloaded to ${downloadPath}`);
|
||||||
core.info('📦 Extracting UPX...');
|
core.info('📦 Extracting UPX...');
|
||||||
const extPath = osPlat == 'win32' ? yield tc.extractZip(downloadPath) : yield tc.extractTar(downloadPath, undefined, 'x');
|
let extPath;
|
||||||
|
if (osPlat == 'win32') {
|
||||||
|
extPath = yield tc.extractZip(downloadPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
extPath = yield tc.extractTar(downloadPath, undefined, 'x');
|
||||||
|
}
|
||||||
core.debug(`Extracted to ${extPath}`);
|
core.debug(`Extracted to ${extPath}`);
|
||||||
const cachePath = yield tc.cacheDir(extPath, 'ghaction-upx', version);
|
const cachePath = yield tc.cacheDir(extPath, 'ghaction-upx', semver);
|
||||||
core.debug(`Cached to ${cachePath}`);
|
core.debug(`Cached to ${cachePath}`);
|
||||||
const exePath = path.join(cachePath, getName(semver), osPlat == 'win32' ? 'upx.exe' : 'upx');
|
const exePath = path.join(cachePath, getName(semver), osPlat == 'win32' ? 'upx.exe' : 'upx');
|
||||||
core.debug(`Exe path is ${exePath}`);
|
core.debug(`Exe path is ${exePath}`);
|
||||||
@@ -4692,7 +4696,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const httpm = __importStar(__webpack_require__(539));
|
const httpm = __importStar(__webpack_require__(539));
|
||||||
exports.getRelease = (version) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getRelease = (version) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const url = `https://github.com/upx/upx/releases/${version !== 'latest' ? `v${version}` : version}`;
|
const url = `https://github.com/upx/upx/releases/${version}`;
|
||||||
const http = new httpm.HttpClient('ghaction-upx');
|
const http = new httpm.HttpClient('ghaction-upx');
|
||||||
return (yield http.getJson(url)).result;
|
return (yield http.getJson(url)).result;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ module.exports = {
|
|||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest'
|
||||||
},
|
},
|
||||||
verbose: true
|
verbose: false
|
||||||
}
|
}
|
||||||
3352
package-lock.json
generated
3352
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -7,7 +7,8 @@
|
|||||||
"test": "jest --coverage",
|
"test": "jest --coverage",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"pre-checkin": "npm run format && npm run build"
|
"cleanup-paths": "removeNPMAbsolutePaths ./ --force --fields _where _args",
|
||||||
|
"pre-checkin": "npm run format && npm run cleanup-paths && npm run build"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -27,13 +28,14 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.2.1",
|
"@types/jest": "^25.2.1",
|
||||||
"@types/node": "^13.13.4",
|
"@types/node": "^13.13.5",
|
||||||
"@zeit/ncc": "^0.22.1",
|
"@zeit/ncc": "^0.22.1",
|
||||||
"jest": "^25.5.0",
|
"jest": "^25.5.4",
|
||||||
"jest-circus": "^25.5.0",
|
"jest-circus": "^25.5.4",
|
||||||
"jest-runtime": "^25.5.0",
|
"jest-runtime": "^25.5.4",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"ts-jest": "^25.4.0",
|
"removeNPMAbsolutePaths": "^2.0.0",
|
||||||
|
"ts-jest": "^25.5.1",
|
||||||
"typescript": "^3.8.3",
|
"typescript": "^3.8.3",
|
||||||
"typescript-formatter": "^7.2.2"
|
"typescript-formatter": "^7.2.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface GitHubRelease {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
|
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
|
||||||
const url: string = `https://github.com/upx/upx/releases/${version !== 'latest' ? `v${version}` : version}`;
|
const url: string = `https://github.com/upx/upx/releases/${version}`;
|
||||||
const http: httpm.HttpClient = new httpm.HttpClient('ghaction-upx');
|
const http: httpm.HttpClient = new httpm.HttpClient('ghaction-upx');
|
||||||
return (await http.getJson<GitHubRelease>(url)).result;
|
return (await http.getJson<GitHubRelease>(url)).result;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,17 +5,15 @@ import * as github from './github';
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
let osPlat: string = os.platform();
|
const osPlat: string = os.platform();
|
||||||
let osArch: string = os.arch();
|
const osArch: string = os.arch();
|
||||||
|
|
||||||
export async function getUPX(version: string): Promise<string> {
|
export async function getUPX(version: string): Promise<string> {
|
||||||
const release: github.GitHubRelease | null = await github.getRelease(version);
|
const release: github.GitHubRelease | null = await github.getRelease(version);
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(`Cannot find UPX ${version} release`);
|
throw new Error(`Cannot find UPX ${version} release`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const semver: string = release.tag_name.replace(/^v/, '');
|
const semver: string = release.tag_name.replace(/^v/, '');
|
||||||
core.debug(`Semver is ${semver}`);
|
|
||||||
|
|
||||||
core.info(`✅ UPX version found: ${semver}`);
|
core.info(`✅ UPX version found: ${semver}`);
|
||||||
const filename = util.format('%s.%s', getName(semver), osPlat == 'win32' ? 'zip' : 'tar.xz');
|
const filename = util.format('%s.%s', getName(semver), osPlat == 'win32' ? 'zip' : 'tar.xz');
|
||||||
@@ -26,11 +24,15 @@ export async function getUPX(version: string): Promise<string> {
|
|||||||
core.debug(`Downloaded to ${downloadPath}`);
|
core.debug(`Downloaded to ${downloadPath}`);
|
||||||
|
|
||||||
core.info('📦 Extracting UPX...');
|
core.info('📦 Extracting UPX...');
|
||||||
const extPath: string =
|
let extPath: string;
|
||||||
osPlat == 'win32' ? await tc.extractZip(downloadPath) : await tc.extractTar(downloadPath, undefined, 'x');
|
if (osPlat == 'win32') {
|
||||||
|
extPath = await tc.extractZip(downloadPath);
|
||||||
|
} else {
|
||||||
|
extPath = await tc.extractTar(downloadPath, undefined, 'x');
|
||||||
|
}
|
||||||
core.debug(`Extracted to ${extPath}`);
|
core.debug(`Extracted to ${extPath}`);
|
||||||
|
|
||||||
const cachePath: string = await tc.cacheDir(extPath, 'ghaction-upx', version);
|
const cachePath: string = await tc.cacheDir(extPath, 'ghaction-upx', semver);
|
||||||
core.debug(`Cached to ${cachePath}`);
|
core.debug(`Cached to ${cachePath}`);
|
||||||
|
|
||||||
const exePath: string = path.join(cachePath, getName(semver), osPlat == 'win32' ? 'upx.exe' : 'upx');
|
const exePath: string = path.join(cachePath, getName(semver), osPlat == 'win32' ? 'upx.exe' : 'upx');
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as installer from './installer';
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
export async function run() {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (os.platform() == 'darwin') {
|
if (os.platform() == 'darwin') {
|
||||||
core.setFailed('Not supported on darwin platform');
|
core.setFailed('Not supported on darwin platform');
|
||||||
|
|||||||
Reference in New Issue
Block a user