Skip to content

Commit

Permalink
Fix a regression
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Apr 27, 2024
1 parent 6d434f3 commit c18c8f4
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 123 deletions.
36 changes: 18 additions & 18 deletions bin/setup_hashlink.cjs

Large diffs are not rendered by default.

96 changes: 0 additions & 96 deletions res/releases.json

This file was deleted.

16 changes: 9 additions & 7 deletions bin/setup_hashlink.js → src/cli.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env node
import {getInput, info, setFailed} from "@actions/core";
import {Release, Setup} from "../src/index.js";
import {Release, Setup} from "./index.js";

// Start the application.
try {
/**
* Application entry point.
* @returns {Promise<void>} Resolves when HashLink has been installed.
*/
async function main() {
const version = getInput("version");
const release = Release.find(!version || version == "latest" ? "*" : version);
if (!release) throw Error("No release matching the version constraint.");

const path = await new Setup(release).install();
info(`HashLink ${release.version} successfully installed in "${path}".`);
}
catch(error) {
setFailed(error instanceof Error ? error : String(error))
}

// Start the application.
main().catch(error => setFailed(error instanceof Error ? error : String(error)));
99 changes: 99 additions & 0 deletions src/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* The release data.
*/
export default [
{
version: "1.14.0",
assets: [
{platform: "win32", file: "hashlink-1.14.0-win.zip"}
]
},
{
version: "1.13.0",
assets: [
{platform: "win32", file: "hashlink-1.13.0-win.zip"}
]
},
{
version: "1.12.0",
assets: [
{platform: "win32", file: "hl-1.12.0-win.zip"}
]
},
{
version: "1.11.0",
assets: [
{platform: "win32", file: "hl-1.11.0-win.zip"}
]
},
{
version: "1.10.0",
assets: [
{platform: "win32", file: "hl-1.10.0-win.zip"}
]
},
{
version: "1.9.0",
assets: [
{platform: "win32", file: "hl-1.9.0-win.zip"}
]
},
{
version: "1.8.0",
assets: [
{platform: "win32", file: "hl-1.8.0-win.zip"}
]
},
{
version: "1.7.0",
assets: [
{platform: "win32", file: "hl-1.7.0-win.zip"}
]
},
{
version: "1.6.0",
assets: [
{platform: "linux", file: "hl-1.6.0-linux.tgz"},
{platform: "win32", file: "hl-1.6.0-win.zip"}
]
},
{
version: "1.5.0",
assets: [
{platform: "linux", file: "hl-1.5.0-linux.tgz"},
{platform: "win32", file: "hl-1.5.0-win.zip"}
]
},
{
version: "1.4.0",
assets: [
{platform: "win32", file: "hl-1.4-win.zip"}
]
},
{
version: "1.3.0",
assets: [
{platform: "darwin", file: "hl-1.3-osx32.zip"},
{platform: "win32", file: "hl-1.3-win32.zip"}
]
},
{
version: "1.2.0",
assets: [
{platform: "darwin", file: "hl-1.2-osx.zip"},
{platform: "win32", file: "hl-1.2-win32.zip"}
]
},
{
version: "1.1.0",
assets: [
{platform: "win32", file: "hl-1.1-win32.zip"}
]
},
{
version: "1.0.0",
assets: [
{platform: "win32", file: "hl-1.0-win32.zip"}
]
}
];
4 changes: 2 additions & 2 deletions src/release.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from "node:process";
import semver, {SemVer} from "semver";
import releases from "../res/releases.json" with {type: "json"};
import data from "./data.js";

/**
* Represents a GitHub release.
Expand All @@ -19,7 +19,7 @@ export class Release {
* @type {Release[]}
* @readonly
*/
static #data = releases.map(release => new this(release.version, release.assets));
static #data = data.map(release => new this(release.version, release.assets));

/**
* The associated assets.
Expand Down
1 change: 1 addition & 0 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "../tsconfig.json",
"exclude": ["cli.js"],
"include": ["**/*.js"],
"compilerOptions": {
"declaration": true,
Expand Down

0 comments on commit c18c8f4

Please sign in to comment.