mirror of
https://github.com/crazy-max/ghaction-upx.git
synced 2026-04-14 10:32:59 -06:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9dbb9c3ca | ||
|
|
2034dbc765 | ||
|
|
2b3459b026 | ||
|
|
76c12355bd | ||
|
|
c544706a19 | ||
|
|
c26e09cbb4 | ||
|
|
4c84b78119 | ||
|
|
66ae810f53 | ||
|
|
6f73f46fce | ||
|
|
99ca5b010b | ||
|
|
04c1b0be04 | ||
|
|
ce00daae27 | ||
|
|
7648f29744 | ||
|
|
7d4b8f5604 | ||
|
|
a584dfa158 | ||
|
|
001bed2881 | ||
|
|
4cd391c02d | ||
|
|
39152071b7 | ||
|
|
cd7336ce6f | ||
|
|
9a5a78f329 |
1
.github/upx-releases.json
vendored
Normal file
1
.github/upx-releases.json
vendored
Normal file
File diff suppressed because one or more lines are too long
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -10,9 +10,8 @@ on:
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '.github/upx-releases.json'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
|
||||
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
@@ -6,9 +6,8 @@ on:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths-ignore:
|
||||
- '.github/upx-releases.json'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
58
.github/workflows/upx-releases-json.yml
vendored
Normal file
58
.github/workflows/upx-releases-json.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
name: upx-releases-json
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 10 * * 0'
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '.github/upx-releases.json'
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
uses: crazy-max/.github/.github/workflows/releases-json.yml@002654044825b3c2b9856af61b8a2aaf389706b1
|
||||
with:
|
||||
repository: upx/upx
|
||||
artifact_name: upx-releases-json
|
||||
filename: upx-releases.json
|
||||
secrets: inherit
|
||||
|
||||
open-pr:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event_name != 'pull_request'
|
||||
needs:
|
||||
- generate
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Download
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: upx-releases-json
|
||||
path: .github
|
||||
-
|
||||
name: Commit changes
|
||||
run: |
|
||||
git add -A .
|
||||
-
|
||||
name: Create PR
|
||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04
|
||||
with:
|
||||
base: master
|
||||
branch: bot/upx-releases-json
|
||||
commit-message: "update .github/upx-releases.json"
|
||||
signoff: true
|
||||
delete-branch: true
|
||||
title: "Update `.github/upx-releases.json`"
|
||||
body: |
|
||||
Update `.github/upx-releases.json` to keep in sync with [https://github.com/upx/upx](https://github.com/upx/upx).
|
||||
draft: false
|
||||
60
CHANGELOG.md
60
CHANGELOG.md
@@ -1,60 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## 2.0.0 (2022/05/26)
|
||||
|
||||
* Node 16 as default runtime (#169)
|
||||
* This requires a minimum [Actions Runner](https://github.com/actions/runner/releases/tag/v2.285.0) version of v2.285.0, which is by default available in GHES 3.4 or later.
|
||||
|
||||
## 1.5.0 (2022/05/26)
|
||||
|
||||
* Update dev dependencies and workflow (#168)
|
||||
* Bump @actions/core from 1.2.6 to 1.6.0 (#142 #158 #161)
|
||||
* Bump @actions/exec from 1.0.4 to 1.1.1 (#152 #164)
|
||||
* Bump @actions/tool-cache from 1.6.1 to 1.7.2 (#151 #165)
|
||||
* Bump minimist from 1.2.5 to 1.2.6 (#166)
|
||||
* Bump ansi-regex from 5.0.0 to 5.0.1 (#160)
|
||||
* Bump tmpl from 1.0.4 to 1.0.5 (#159)
|
||||
* Bump path-parse from 1.0.6 to 1.0.7 (#157)
|
||||
* Bump hosted-git-info from 2.8.8 to 2.8.9 (#154)
|
||||
* Bump ws from 7.3.0 to 7.5.0 (#155)
|
||||
* Bump lodash from 4.17.20 to 4.17.21 (#153)
|
||||
* Bump y18n from 4.0.0 to 4.0.3 (#143)
|
||||
|
||||
## 1.4.0 (2021/03/27)
|
||||
|
||||
* Allow multiple files (#140)
|
||||
* Container dev workflow (#139)
|
||||
* Bump node-notifier from 8.0.0 to 8.0.1 (#135)
|
||||
* Bump @actions/tool-cache from 1.6.0 to 1.6.1 (#134)
|
||||
* Bump @actions/http-client from 1.0.8 to 1.0.11 (#131 #138)
|
||||
|
||||
## 1.3.3 (2020/10/01)
|
||||
|
||||
* Fix CVE-2020-15228
|
||||
|
||||
## 1.3.2 (2020/05/11)
|
||||
|
||||
* Update README
|
||||
|
||||
## 1.3.1 (2020/05/07)
|
||||
|
||||
* Code cleanup
|
||||
|
||||
## 1.3.0 (2020/05/06)
|
||||
|
||||
* Use native tools
|
||||
* Add Codecov
|
||||
* Update deps
|
||||
|
||||
## 1.2.0 (2020/04/09)
|
||||
|
||||
* Use ncc and clean workflows
|
||||
* Update deps
|
||||
|
||||
## 1.1.0 (2020/01/17)
|
||||
|
||||
* Update deps
|
||||
|
||||
## 1.0.0 (2020/01/17)
|
||||
|
||||
* Initial version
|
||||
@@ -1,6 +1,6 @@
|
||||
[](https://github.com/crazy-max/ghaction-upx/releases/latest)
|
||||
[](https://github.com/marketplace/actions/upx-github-action)
|
||||
[](https://github.com/crazy-max/ghaction-upx/actions?workflow=test)
|
||||
[](https://github.com/crazy-max/ghaction-upx/actions?workflow=test)
|
||||
[](https://codecov.io/gh/crazy-max/ghaction-upx)
|
||||
[](https://github.com/sponsors/crazy-max)
|
||||
[](https://www.paypal.me/crazyws)
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
GitHub Action for [UPX](https://github.com/upx/upx), the Ultimate Packer for eXecutables.
|
||||
|
||||
If you are interested, [check out](https://github.com/crazy-max?tab=repositories&q=ghaction&type=source&language=&sort=) my other :octocat: GitHub Actions!
|
||||
|
||||

|
||||
|
||||
___
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import {describe, expect, it} from '@jest/globals';
|
||||
import * as github from '../src/github';
|
||||
|
||||
describe('github', () => {
|
||||
it('returns latest UPX GitHub release', async () => {
|
||||
const release = await github.getRelease('latest');
|
||||
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');
|
||||
expect(release).not.toBeNull();
|
||||
expect(release?.tag_name).toEqual('v3.96');
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,30 @@ import {describe, expect, it} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import * as installer from '../src/installer';
|
||||
|
||||
describe('getRelease', () => {
|
||||
it('returns latest UPX GitHub release', async () => {
|
||||
const release = await installer.getRelease('latest');
|
||||
expect(release).not.toBeNull();
|
||||
expect(release?.tag_name).not.toEqual('');
|
||||
});
|
||||
|
||||
it('returns v3.95 UPX GitHub release', async () => {
|
||||
const release = await installer.getRelease('v3.95');
|
||||
expect(release).not.toBeNull();
|
||||
expect(release?.id).toEqual(12577195);
|
||||
expect(release?.tag_name).toEqual('v3.95');
|
||||
expect(release?.html_url).toEqual('https://github.com/upx/upx/releases/tag/v3.95');
|
||||
});
|
||||
|
||||
it('unknown release', async () => {
|
||||
await expect(installer.getRelease('foo')).rejects.toThrowError(
|
||||
new Error(
|
||||
'Cannot find UPX release foo in https://raw.githubusercontent.com/crazy-max/ghaction-upx/master/.github/upx-releases.json'
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('installer', () => {
|
||||
it('acquires v3.95 version of UPX', async () => {
|
||||
const upx = await installer.getUPX('v3.95');
|
||||
|
||||
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
@@ -1,12 +0,0 @@
|
||||
import * as httpm from '@actions/http-client';
|
||||
|
||||
export interface GitHubRelease {
|
||||
id: number;
|
||||
tag_name: string;
|
||||
}
|
||||
|
||||
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
|
||||
const url = `https://github.com/upx/upx/releases/${version}`;
|
||||
const http: httpm.HttpClient = new httpm.HttpClient('ghaction-upx');
|
||||
return (await http.getJson<GitHubRelease>(url)).result;
|
||||
};
|
||||
@@ -1,22 +1,40 @@
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as util from 'util';
|
||||
import * as github from './github';
|
||||
import * as core from '@actions/core';
|
||||
import * as httpm from '@actions/http-client';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
|
||||
const osPlat: string = os.platform();
|
||||
const osArch: string = os.arch();
|
||||
|
||||
export async function getUPX(version: string): Promise<string> {
|
||||
core.startGroup(`Checking UPX ${version} release...`);
|
||||
const release: github.GitHubRelease | null = await github.getRelease(version);
|
||||
if (!release) {
|
||||
throw new Error(`Cannot find UPX ${version} release`);
|
||||
export interface GitHubRelease {
|
||||
id: number;
|
||||
tag_name: string;
|
||||
html_url: string;
|
||||
assets: Array<string>;
|
||||
}
|
||||
|
||||
export const getRelease = async (version: string): Promise<GitHubRelease> => {
|
||||
const url = `https://raw.githubusercontent.com/crazy-max/ghaction-upx/master/.github/upx-releases.json`;
|
||||
const http: httpm.HttpClient = new httpm.HttpClient('ghaction-upx');
|
||||
const resp: httpm.HttpClientResponse = await http.get(url);
|
||||
const body = await resp.readBody();
|
||||
const statusCode = resp.message.statusCode || 500;
|
||||
if (statusCode >= 400) {
|
||||
throw new Error(`Failed to get UPX release ${version} from ${url} with status code ${statusCode}: ${body}`);
|
||||
}
|
||||
const releases = <Record<string, GitHubRelease>>JSON.parse(body);
|
||||
if (!releases[version]) {
|
||||
throw new Error(`Cannot find UPX release ${version} in ${url}`);
|
||||
}
|
||||
return releases[version];
|
||||
};
|
||||
|
||||
export async function getUPX(version: string): Promise<string> {
|
||||
const release: GitHubRelease = await getRelease(version);
|
||||
const semver: string = release.tag_name.replace(/^v/, '');
|
||||
core.info(`UPX ${semver} found`);
|
||||
core.endGroup();
|
||||
|
||||
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);
|
||||
|
||||
34
yarn.lock
34
yarn.lock
@@ -1206,9 +1206,9 @@ babel-preset-jest@^27.5.1:
|
||||
babel-preset-current-node-syntax "^1.0.0"
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
@@ -1365,7 +1365,7 @@ combined-stream@^1.0.8:
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
|
||||
|
||||
convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0:
|
||||
version "1.7.0"
|
||||
@@ -2584,17 +2584,10 @@ json-stable-stringify-without-jsonify@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
|
||||
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=
|
||||
|
||||
json5@2.x, json5@^2.1.2:
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43"
|
||||
integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
|
||||
dependencies:
|
||||
minimist "^1.2.5"
|
||||
|
||||
json5@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
|
||||
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
|
||||
json5@2.x, json5@^2.1.2, json5@^2.2.1:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
|
||||
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
|
||||
|
||||
kleur@^3.0.3:
|
||||
version "3.0.3"
|
||||
@@ -2716,17 +2709,12 @@ mimic-fn@^2.1.0:
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.5:
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
ms@2.1.2, ms@^2.1.1:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||
|
||||
Reference in New Issue
Block a user