Skip to content

Commit 43ad51d

Browse files
committed
homebrew fix
1 parent 9a5d1f3 commit 43ad51d

4 files changed

Lines changed: 29 additions & 21 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/se
1717

1818
```yaml
1919
- name: setup StackQL
20-
uses: stackql/setup-stackql@v2.1.0
20+
uses: stackql/setup-stackql@v2.2.0
2121
with:
2222
use_wrapper: true
2323

@@ -34,7 +34,7 @@ Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/se
3434
3535
```yaml
3636
- name: setup StackQL
37-
uses: stackql/setup-stackql@v2.1.0
37+
uses: stackql/setup-stackql@v2.2.0
3838
with:
3939
use_wrapper: true
4040

dist/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6768,17 +6768,21 @@ async function downloadCLI(osPlatform) {
67686768
case 'win32':
67696769
return await tc.extractZip(await tc.downloadTool(urls[osPlatform]));
67706770
case 'darwin':
6771-
// Check if stackql is already installed and skip if it is
6771+
// Use brew info --json to check if stackql is installed
67726772
core.info(`Checking if stackql is already installed`);
6773-
const isInstalled = execSync('brew list stackql', { stdio: 'pipe', encoding: 'utf-8' });
6774-
if (isInstalled.includes('stackql')) {
6775-
core.info(`stackql is already installed.`);
6776-
const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
6777-
core.debug(`Stackql is located at: ${stackqlPath}`);
6778-
return path.dirname(stackqlPath); // Return the directory of the binary
6773+
try {
6774+
const brewInfo = execSync('brew info stackql --json', { encoding: 'utf-8' });
6775+
const brewInfoJson = JSON.parse(brewInfo);
6776+
if (brewInfoJson[0].installed.length > 0) {
6777+
core.info(`stackql is already installed.`);
6778+
const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
6779+
core.debug(`Stackql is located at: ${stackqlPath}`);
6780+
return path.dirname(stackqlPath); // Return the directory of the binary
6781+
}
6782+
} catch (error) {
6783+
core.info(`stackql is not installed, installing now...`);
6784+
execSync('brew install stackql', { stdio: 'inherit' });
67796785
}
6780-
core.info(`Installing stackql using Homebrew`);
6781-
execSync('brew install stackql', { stdio: 'inherit' });
67826786
const installedPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
67836787
core.debug(`Stackql installed at: ${installedPath}`);
67846788
return path.dirname(installedPath); // Return the directory of the binary

index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,21 @@ async function downloadCLI(osPlatform) {
1919
case 'win32':
2020
return await tc.extractZip(await tc.downloadTool(urls[osPlatform]));
2121
case 'darwin':
22-
// Check if stackql is already installed and skip if it is
22+
// Use brew info --json to check if stackql is installed
2323
core.info(`Checking if stackql is already installed`);
24-
const isInstalled = execSync('brew list stackql', { stdio: 'pipe', encoding: 'utf-8' });
25-
if (isInstalled.includes('stackql')) {
26-
core.info(`stackql is already installed.`);
27-
const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
28-
core.debug(`Stackql is located at: ${stackqlPath}`);
29-
return path.dirname(stackqlPath); // Return the directory of the binary
24+
try {
25+
const brewInfo = execSync('brew info stackql --json', { encoding: 'utf-8' });
26+
const brewInfoJson = JSON.parse(brewInfo);
27+
if (brewInfoJson[0].installed.length > 0) {
28+
core.info(`stackql is already installed.`);
29+
const stackqlPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
30+
core.debug(`Stackql is located at: ${stackqlPath}`);
31+
return path.dirname(stackqlPath); // Return the directory of the binary
32+
}
33+
} catch (error) {
34+
core.info(`stackql is not installed, installing now...`);
35+
execSync('brew install stackql', { stdio: 'inherit' });
3036
}
31-
core.info(`Installing stackql using Homebrew`);
32-
execSync('brew install stackql', { stdio: 'inherit' });
3337
const installedPath = execSync('which stackql', { encoding: 'utf-8' }).trim();
3438
core.debug(`Stackql installed at: ${installedPath}`);
3539
return path.dirname(installedPath); // Return the directory of the binary

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-stackql",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)