|
2 | 2 |
|
3 | 3 | # setup-stackql |
4 | 4 |
|
5 | | -The `stackql/setup-stackql` action is a JavaScript action that sets up StackQL CLI in your GitHub Actions workflow by: |
6 | | - |
7 | | -- Downloading a latest Stackql CLI and adding it to the `PATH`. |
8 | | -- Setup AUTH env var in the Github Action |
| 5 | +The `stackql/setup-stackql` action is a JavaScript action that sets up StackQL CLI in your GitHub Actions workflow by downloading a latest Stackql CLI and adding it to the `PATH`. |
9 | 6 |
|
10 | 7 | This action can be run on `ubuntu-latest`, `windows-latest`, and `macos-latest` GitHub Actions runners, and will install and expose the latest version of the `stackql` CLI on the runner environment. |
11 | 8 |
|
12 | | -# Usage |
13 | | -[Learn more](https://stackql.io/docs/getting-started/authenticating) about authentication setup when running stackql |
| 9 | +## Usage |
| 10 | +Authentication to StackQL providers is done via environment variables source from GitHub Actions Secrets. To learn more about authentication, see the setup instructions for your provider or providers at the [StackQL Provider Registry Docs](https://stackql.io/registry). |
14 | 11 |
|
15 | | -## Basic Example |
16 | | -1. Set Auth variable, for example: |
17 | | -``` |
18 | | -{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } } |
19 | | -``` |
20 | | -2. create the github token as a secret |
21 | | -3. In the execution step, pass the secret as environment variable with name "STACKQL_GITHUB_CREDS" |
| 12 | +## Examples |
| 13 | +The following example demonstrate the use of the `stackql/setup-stackql` action in a GitHub Actions workflow, demonstrating how to use the action to install the `stackql` CLI and then use it to execute a StackQL query. |
22 | 14 |
|
23 | | -Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example |
| 15 | +### GitHub Example |
| 16 | +Check the "Use GitHub Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example, for more information on the GitHub provider for StackQL, see the [GitHub Provider Docs](https://registry.stackql.io/github). |
| 17 | + |
| 18 | +```yaml |
| 19 | + - name: setup StackQL |
| 20 | + uses: stackql/setup-stackql@v1.2.0 |
| 21 | + with: |
| 22 | + use_wrapper: true |
24 | 23 |
|
25 | | -### Example |
26 | | -``` |
27 | 24 | - name: Use GitHub Provider |
28 | 25 | run: | |
29 | | - stackql exec -i ./examples/github-example.iql --auth='{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }' |
| 26 | + stackql exec -i ./examples/github-example.iql |
30 | 27 | env: |
31 | | - STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }} |
32 | | -``` |
33 | | - |
34 | | - |
35 | | -## json File Auth example |
36 | | - |
37 | | -1. Set Auth variable, for example: |
| 28 | + STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }} |
| 29 | + STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }} |
38 | 30 | ``` |
39 | | -{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }} |
40 | | -``` |
41 | | -2. encode the key json file into base64 string |
42 | | -3. in execution step, run `sudo echo ${{ secrets.<name of the secret> }} | base64 -d > sa-key.json` |
43 | 31 |
|
44 | | -Check the "Prep Google Creds" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example |
| 32 | +### Google Example |
| 33 | +Check the "Use Google Provider" step in [setup-stackql.yml](.github/workflows/setup-stackql.yml) for the working example, for more information on the Google provider for StackQL, see the [Google Provider Docs](https://registry.stackql.io/google). |
45 | 34 |
|
46 | | -### Example |
47 | | -``` |
48 | | - - name: Prep Google Creds (bash) |
49 | | - if: ${{ matrix.os != 'windows-latest' }} |
50 | | - run: | ## use the secret to create json file |
51 | | - sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json |
| 35 | +```yaml |
| 36 | + - name: setup StackQL |
| 37 | + uses: stackql/setup-stackql@v1.2.0 |
| 38 | + with: |
| 39 | + use_wrapper: true |
52 | 40 |
|
53 | 41 | - name: Use Google Provider |
54 | 42 | run: | |
55 | | - stackql exec -i ./examples/google-example.iql --auth='{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}' |
| 43 | + stackql exec -i ./examples/google-example.iql |
| 44 | + env: |
| 45 | + GOOGLE_CREDENTIALS : ${{ secrets.GOOGLE_CREDENTIALS }} |
56 | 46 | ``` |
57 | 47 |
|
58 | 48 | ## Inputs |
|
0 commit comments