Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom explicit argus version #56

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions __tests__/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,15 @@ describe('installer', () => {
},
5 * 60 * 1000
);

it.onLinux(
'installs custom argus version',
async () => {
const dir = await fs.mkdtemp(path.join(tmpdir, 'lstn-'));
const argus = await installer.argusFor('latest', dir, 'v0.1.1');
const code = await exec.exec(argus, ['-v']);
expect(code).toBe(0);
},
5 * 60 * 1000
);
});
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ inputs:
description: "Additional lstn CLI flags"
required: false
default: ""
argus_version:
description: "Custom argus version"
required: false
default: ""

runs:
using: "node20"
Expand Down
9 changes: 5 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export async function lstn(tag: string, directory: string): Promise<string> {

export async function argusFor(
tag: string,
directory: string
directory: string,
explicitTag?: string
): Promise<string> {
// Argus only runs on linux amd64
const plat = getPlat(process.platform.toString());
Expand All @@ -54,7 +55,7 @@ export async function argusFor(
throw new Error(`unsupported arch: ${arch}`);
}

const argusTag = getArgusTag(tag);
const argusTag = !explicitTag ? getArgusTag(tag) : explicitTag;
const owner = 'listendev';
const repo = 'argus-releases';
const vers = await tagToVersion(argusTag, owner, repo);
Expand Down
9 changes: 7 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ async function run() {
const tmpdir = await fs.mkdtemp(path.join(runnertmp, 'lstn-'));

try {
const runArgus = core.getInput('ci') == 'true';
const runArgus = core.getInput('ci') == 'true'; // FIXME: switch to core.getBooleanInput() ?
const customArgusVersion = core.getInput('argus_version');
const jwt = core.getInput('jwt');
const version = core.getInput('lstn');
const workdir = core.getInput('workdir');
Expand All @@ -38,7 +39,11 @@ async function run() {
'👁️‍🗨️ Installing argus... https://listen.dev',
async () => {
// Install argus for lstn
const location = await install.argusFor(version, tmpdir);
const location = await install.argusFor(
version,
tmpdir,
customArgusVersion
);
// Moving argus to /usr/bin
const dest = '/usr/bin/argus';
core.info(`moving argus to ${path.dirname(dest)}`);
Expand Down
Loading