Skip to content

Commit fdcb6f1

Browse files
print version
0 parents  commit fdcb6f1

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

.github/set-up-stackql.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Setup Terraform'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
stackql-versions:
15+
name: 'Stackql Versions'
16+
runs-on: ${{ matrix.platform }}
17+
strategy:
18+
matrix:
19+
platform: [ubuntu-latest]
20+
terraform-versions: [0.11.14, latest]
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
- name: Setup stackql
27+
uses: ./
28+
with:
29+
platform: ${{ matrix['platform'] }}
30+
31+
- name: Validate stackql Version
32+
run: stackql version

action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'StackQL Studio - Setup StackQL'
2+
description: 'Sets up StackQL CLI in your GitHub Actions workflow.'
3+
author: 'Yuncheng Yang, StackQL'
4+
inputs:
5+
platform:
6+
description: 'Platform that function is running on'
7+
required: true
8+
# authentications_object_string:
9+
# description: 'The authentication object'
10+
# required: true
11+
# stackql_wrapper:
12+
# description: 'Whether or not to install a wrapper to wrap subsequent calls of the `stackql` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.'
13+
# default: 'true'
14+
# required: false
15+
runs:
16+
using: 'node16'
17+
main: 'index.js'
18+
branding:
19+
icon: 'terminal'
20+
color: 'purple'

index.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const fs = require('fs').promises;
2+
const os = require('os');
3+
const path = require('path');
4+
5+
// External
6+
const core = require('@actions/core');
7+
const tc = require('@actions/tool-cache');
8+
const io = require('@actions/io');
9+
10+
const urls = {
11+
'windows': 'https://releases.stackql.io/stackql/latest/stackql_windows_amd64.zip',
12+
'ubuntu': 'https://storage.googleapis.com/stackql-public-releases/latest/stackql_darwin_multiarch.pkg',
13+
'macos': 'https://releases.stackql.io/stackql/latest/stackql_linux_amd64.zip'
14+
}
15+
16+
async function downloadCLI(os){
17+
try {
18+
const url = urls[os]
19+
const pathToCLIZip = await tc.downloadTool(url);
20+
core.addPath(pathToCLIZip);
21+
22+
} catch (error) {
23+
core.error(error);
24+
throw error;
25+
}
26+
}
27+
28+
async function setup(){
29+
const platform = core.getInput('running-platform');
30+
const os = platform.split('-')[0]
31+
32+
if(!(Object.keys(urls).includes(os))){
33+
throw Error('Cannot find os name %o', os)
34+
}
35+
36+
await downloadCLI(os)
37+
}
38+
39+
(async () => {
40+
try {
41+
await setup();
42+
} catch (error) {
43+
core.setFailed(error.message);
44+
}
45+
})();

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "setup-stackql",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/stackql/setup-stackql.git"
12+
},
13+
"keywords": [],
14+
"author": "",
15+
"license": "ISC",
16+
"bugs": {
17+
"url": "https://github.com/stackql/setup-stackql/issues"
18+
},
19+
"homepage": "https://github.com/stackql/setup-stackql#readme"
20+
}

0 commit comments

Comments
 (0)