Skip to content

Commit

Permalink
refactor: init DIST w/ prefix for FILENAME
Browse files Browse the repository at this point in the history
Signed-off-by: Dwi Siswanto <git@dw1.io>
  • Loading branch information
dwisiswant0 committed Jan 12, 2025
1 parent da3b74f commit b7a7674
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const inputVersion = const_1.core.getInput('version', { required: false });
let inputTag = const_1.core.getInput('tag', { required: true });
function get_slim() {
return __awaiter(this, void 0, void 0, function* () {
let DIST = '';
let DIST = 'dist_';
let EXT = '';
let FILENAME = '';
let KERNEL = '';
Expand Down Expand Up @@ -60,33 +60,33 @@ function get_slim() {
if (KERNEL === 'linux') {
EXT = 'tar.gz';
if (MACHINE === 'x64') {
DIST = 'linux';
DIST += 'linux';
}
else if (MACHINE === 'arm') {
DIST = 'linux_arm';
DIST += 'linux_arm';
}
else if (MACHINE === 'arm64') {
DIST = 'linux_arm64';
DIST += 'linux_arm64';
}
}
else if (KERNEL === 'darwin') {
EXT = 'zip';
if (MACHINE === 'x64') {
DIST = 'mac';
DIST += 'mac';
}
else if (MACHINE === 'arm64') {
DIST = 'mac_m1';
DIST += 'mac_m1';
}
}
else {
throw new Error(`${KERNEL} is not a supported platform.`);
}
// Was a known distribution detected?
if (!DIST) {
if (DIST !== 'dist_') {
throw new Error(`${MACHINE} is not a supported architecture.`);
}
// Derive the filename
FILENAME = `dist_${DIST}.${EXT}`;
FILENAME = `${DIST}.${EXT}`;
URL = `https://github.com/slimtoolkit/slim/releases/download/${VER}/${FILENAME}`;
const_1.core.debug(`Checking cache for slim...`);
let slimPath = const_1.tc.find('slim', VER, MACHINE);
Expand Down
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const inputVersion = core.getInput('version', {required: false});
let inputTag = core.getInput('tag', {required: true});

async function get_slim() {
let DIST = '';
let DIST = 'dist_';
let EXT = '';
let FILENAME = '';
let KERNEL = '';
Expand Down Expand Up @@ -56,30 +56,30 @@ async function get_slim() {
if (KERNEL === 'linux') {
EXT = 'tar.gz';
if (MACHINE === 'x64') {
DIST = 'linux';
DIST += 'linux';
} else if (MACHINE === 'arm') {
DIST = 'linux_arm';
DIST += 'linux_arm';
} else if (MACHINE === 'arm64') {
DIST = 'linux_arm64';
DIST += 'linux_arm64';
}
} else if (KERNEL === 'darwin') {
EXT = 'zip';
if (MACHINE === 'x64') {
DIST = 'mac';
DIST += 'mac';
} else if (MACHINE === 'arm64') {
DIST = 'mac_m1';
DIST += 'mac_m1';
}
} else {
throw new Error(`${KERNEL} is not a supported platform.`);
}

// Was a known distribution detected?
if (!DIST) {
if (DIST !== 'dist_') {
throw new Error(`${MACHINE} is not a supported architecture.`);
}

// Derive the filename
FILENAME = `dist_${DIST}.${EXT}`;
FILENAME = `${DIST}.${EXT}`;
URL = `https://github.com/slimtoolkit/slim/releases/download/${VER}/${FILENAME}`;

core.debug(`Checking cache for slim...`)
Expand Down

0 comments on commit b7a7674

Please sign in to comment.