Skip to content

Commit 40dc783

Browse files
committed
updates
1 parent 36fd083 commit 40dc783

2 files changed

Lines changed: 30 additions & 38 deletions

File tree

dist/index.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6789,35 +6789,31 @@ const urls = {
67896789
// }
67906790
// }
67916791

6792-
async function downloadCLI(osPlatform){
6792+
async function downloadCLI(osPlatform) {
67936793
try {
6794-
6795-
core.info(`downloading stackql binary for ${osPlatform}`);
6796-
// const url = urls[osPlatform];
6797-
// core.debug(`binary location: ${url}`);
6794+
core.info(`Preparing to download/install stackql for ${osPlatform}`);
67986795

67996796
switch (osPlatform) {
68006797
case 'win32':
68016798
return await tc.extractZip(await tc.downloadTool(urls[osPlatform]));
68026799
case 'darwin':
6803-
core.info(`installing stackql using Homebrew`);
6800+
core.info(`Installing stackql using Homebrew`);
68046801
execSync('brew install stackql', { stdio: 'inherit' });
6805-
// Assuming stackql installs to a standard location accessible in the PATH
6806-
// No need to return a path since brew handles placing it in the PATH
6807-
return '/usr/local/bin'; // or wherever brew installs binaries
6802+
// Find the installation path using which
6803+
const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
6804+
core.debug(`Stackql installed at: ${stackqlPath}`);
6805+
return path.dirname(stackqlPath); // Return the directory of the binary
68086806
case 'linux':
68096807
return await tc.extractZip(await tc.downloadTool(urls[osPlatform]));
68106808
default:
68116809
throw new Error(`Unsupported platform: ${osPlatform}`);
68126810
}
6813-
68146811
} catch (error) {
6815-
core.error(error);
6812+
core.error(`Failed to install Stackql: ${error}`);
68166813
throw error;
68176814
}
68186815
}
68196816

6820-
68216817
async function makeExecutable(cliPath, osPlatform){
68226818
try {
68236819
if(osPlatform === 'win32'){
@@ -6880,13 +6876,13 @@ async function setup() {
68806876
core.debug(`path to cli: ${cliPath}`);
68816877

68826878
// set perms and make executable
6883-
core.debug(`updating permissions for ${cliPath}`);
6884-
fs.chmodSync(cliPath, '777');
6885-
6886-
core.debug(`adding ${cliPath} to the path`);
6887-
core.addPath(cliPath)
6888-
6889-
await makeExecutable(cliPath, osPlatform)
6879+
if(osPlatform != 'darwin'){
6880+
core.debug(`updating permissions for ${cliPath}`);
6881+
fs.chmodSync(cliPath, '777');
6882+
core.debug(`adding ${cliPath} to the path`);
6883+
core.addPath(cliPath)
6884+
await makeExecutable(cliPath, osPlatform)
6885+
}
68906886

68916887
const wrapper = core.getInput('use_wrapper') === 'true';
68926888

index.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,31 @@ const urls = {
4040
// }
4141
// }
4242

43-
async function downloadCLI(osPlatform){
43+
async function downloadCLI(osPlatform) {
4444
try {
45-
46-
core.info(`downloading stackql binary for ${osPlatform}`);
47-
// const url = urls[osPlatform];
48-
// core.debug(`binary location: ${url}`);
45+
core.info(`Preparing to download/install stackql for ${osPlatform}`);
4946

5047
switch (osPlatform) {
5148
case 'win32':
5249
return await tc.extractZip(await tc.downloadTool(urls[osPlatform]));
5350
case 'darwin':
54-
core.info(`installing stackql using Homebrew`);
51+
core.info(`Installing stackql using Homebrew`);
5552
execSync('brew install stackql', { stdio: 'inherit' });
56-
// Assuming stackql installs to a standard location accessible in the PATH
57-
// No need to return a path since brew handles placing it in the PATH
58-
return '/usr/local/bin'; // or wherever brew installs binaries
53+
// Find the installation path using which
54+
const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
55+
core.debug(`Stackql installed at: ${stackqlPath}`);
56+
return path.dirname(stackqlPath); // Return the directory of the binary
5957
case 'linux':
6058
return await tc.extractZip(await tc.downloadTool(urls[osPlatform]));
6159
default:
6260
throw new Error(`Unsupported platform: ${osPlatform}`);
6361
}
64-
6562
} catch (error) {
66-
core.error(error);
63+
core.error(`Failed to install Stackql: ${error}`);
6764
throw error;
6865
}
6966
}
7067

71-
7268
async function makeExecutable(cliPath, osPlatform){
7369
try {
7470
if(osPlatform === 'win32'){
@@ -131,13 +127,13 @@ async function setup() {
131127
core.debug(`path to cli: ${cliPath}`);
132128

133129
// set perms and make executable
134-
core.debug(`updating permissions for ${cliPath}`);
135-
fs.chmodSync(cliPath, '777');
136-
137-
core.debug(`adding ${cliPath} to the path`);
138-
core.addPath(cliPath)
139-
140-
await makeExecutable(cliPath, osPlatform)
130+
if(osPlatform != 'darwin'){
131+
core.debug(`updating permissions for ${cliPath}`);
132+
fs.chmodSync(cliPath, '777');
133+
core.debug(`adding ${cliPath} to the path`);
134+
core.addPath(cliPath)
135+
await makeExecutable(cliPath, osPlatform)
136+
}
141137

142138
const wrapper = core.getInput('use_wrapper') === 'true';
143139

0 commit comments

Comments
 (0)