Skip to content

Commit

Permalink
feat: support xz
Browse files Browse the repository at this point in the history
Signed-off-by: vados <vados@vadosware.io>
  • Loading branch information
t3hmrman committed Nov 25, 2024
1 parent 50f1dab commit 0a1650b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,21 @@ jobs:
platform: ubuntu
cache: enable
- run: sui --version
weval:
strategy:
matrix:
version: [ "v0.3.2" ]
runs-on: [ "ubuntu-latest" ]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v1
- run: npm ci
- run: npm run build
- uses: ./
with:
repo: bytecodealliance/weval
tag: ${{ matrix.weval }}
extension: "\\.xz"
rename-to: weval.tar.xz
- run:
tar -xvf /opt/hostedtoolcache/bytecodealliance/weval/v0.3.2/linux-x64/weval.tar.xz
11 changes: 9 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { throttling } from "@octokit/plugin-throttling";

const ThrottlingOctokit = GitHub.plugin(throttling);

const SUPPORTED_TAR_EXTENSIONS = [
'.tar.gz',
'.tar.xz',
'.tar.bz2',
'.tgz',
];

interface ToolInfo {
owner: string;
project: string;
Expand Down Expand Up @@ -110,7 +117,7 @@ async function run() {
let extMatchRegexForm = "";
if (extMatching) {
if (extension === "") {
extMatchRegexForm = "\.(tar.gz|zip|tgz)";
extMatchRegexForm = "\.(tar.gz|tar.xz|zip|tgz)";
core.info(`==> Using default file extension matching: ${extMatchRegexForm}`);
} else {
extMatchRegexForm = extension;
Expand Down Expand Up @@ -337,7 +344,7 @@ function getCacheDirectory() {
}

function getExtractFn(assetName: any) {
if (assetName.endsWith('.tar.gz') || assetName.endsWith('.tar.bz2') || assetName.endsWith('.tgz')) {
if (SUPPORTED_TAR_EXTENSIONS.some(ext => assetName.endsWith(ext))) {
return tc.extractTar;
} else if (assetName.endsWith('.zip')) {
return tc.extractZip;
Expand Down

0 comments on commit 0a1650b

Please sign in to comment.