Skip to content

Commit

Permalink
fix: download url
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Jun 12, 2024
1 parent 5392b37 commit afb487a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 12 deletions.
38 changes: 32 additions & 6 deletions action/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30693,13 +30693,39 @@ const tc = __nccwpck_require__(7784);
* @returns {Promise<string>}
*/
async function getDownloadURL(version) {
// Get the platform (i.e. linux, darwin, win32)
const platform = process.platform;
// Get the architecture (i.e. x64, arm64)
const arch = process.arch;
let platform;

core.info(`Platform: ${platform}, Arch: ${arch}`)
const url = `https://github.com/vechain/networkhub/releases/download/${version}/network-hub-${platform}-${arch}${platform === 'win32' ? '.exe' : ''}`;
switch (process.platform) {
case 'win32':
platform = 'windows';
break;
case 'darwin':
platform = 'macos';
break;
case 'linux':
platform = 'linux';
break;
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}

let arch;

switch (process.arch) {
case 'x64':
arch = 'amd64';
break;
case 'arm64':
arch = 'arm64';
break;
default:
throw new Error(`Unsupported architecture: ${process.arch}`);
}

core.info(`Platform: ${platform}`)
core.info(`Arch: ${arch}`)

const url = `https://github.com/vechain/networkhub/releases/download/${version}/network-hub-${platform}-${arch}${process.platform === 'win32' ? '.exe' : ''}`;
core.info(`Download URL: ${url}`)
return url;
}
Expand Down
38 changes: 32 additions & 6 deletions action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,39 @@ const tc = require('@actions/tool-cache');
* @returns {Promise<string>}
*/
async function getDownloadURL(version) {
// Get the platform (i.e. linux, darwin, win32)
const platform = process.platform;
// Get the architecture (i.e. x64, arm64)
const arch = process.arch;
let platform;

core.info(`Platform: ${platform}, Arch: ${arch}`)
const url = `https://github.com/vechain/networkhub/releases/download/${version}/network-hub-${platform}-${arch}${platform === 'win32' ? '.exe' : ''}`;
switch (process.platform) {
case 'win32':
platform = 'windows';
break;
case 'darwin':
platform = 'macos';
break;
case 'linux':
platform = 'linux';
break;
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}

let arch;

switch (process.arch) {
case 'x64':
arch = 'amd64';
break;
case 'arm64':
arch = 'arm64';
break;
default:
throw new Error(`Unsupported architecture: ${process.arch}`);
}

core.info(`Platform: ${platform}`)
core.info(`Arch: ${arch}`)

const url = `https://github.com/vechain/networkhub/releases/download/${version}/network-hub-${platform}-${arch}${process.platform === 'win32' ? '.exe' : ''}`;
core.info(`Download URL: ${url}`)
return url;
}
Expand Down

0 comments on commit afb487a

Please sign in to comment.