Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/stackql-deploy-actions-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Deploy SSM Parameter
uses: ./
with:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
# Uses a `|` block scalar with AWS_REGION on a non-first line so leading-whitespace
# on continuation entries would break the required var if the parser didn't trim.
# UNUSED_* pairs are noise entries the stack does not consume; their presence validates
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Deploy SSM Parameter
uses: ./
with:
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Deploy SSM Parameter
uses: ./
with:
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Deploy SSM Parameter
uses: ./
with:
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Deploy SSM Parameter
uses: ./
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
stackql*
.stackql/
.env
.claude
.claude
/tmp
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ jobs:
run: echo "Workspace is running, proceeding with next steps..."
```

for a complete workflow that also uploads the output file as an artifact and consumes it from a separate job, see [docs/OUTPUTS.md](docs/OUTPUTS.md).

### Test a stack

this example shows how to test stack for a given environment:
Expand Down
97 changes: 97 additions & 0 deletions docs/OUTPUTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,103 @@ jobs:
echo "Data from deploy job: ${{ needs.deploy.outputs.deployment_data }}"
```

### Complete Workflow Example

The following workflow brings the patterns above together. The `deploy` job deploys a stack, prints the outputs, parses individual values with `jq`, writes a table to the step summary, gates a follow-up step on an output value, and uploads the output file as a workflow artifact. A second `post-deploy` job downloads the artifact and reads the file directly.

The JSON is passed to the shell through a step-level `env` variable rather than interpolated with `${{ }}` inside the script, so quotes in output values do not break the command.

```yaml
name: StackQL Deploy with Outputs

on:
push:
branches: [main]
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} # add additional cloud provider creds here as needed

steps:
- name: Checkout
uses: actions/checkout@v7

- name: Deploy with StackQL
id: stackql-deploy
uses: stackql/stackql-deploy-action@v2
with:
command: 'build'
stack_dir: './my-stack'
stack_env: 'prod'
output_file: 'deployment-outputs.json'
env_vars: |
PROJECT_ID=${{ secrets.GOOGLE_PROJECT_ID }}
REGION=us-central1

- name: Display deployment outputs
env:
DEPLOYMENT_OUTPUTS: ${{ steps.stackql-deploy.outputs.deployment_outputs }}
run: |
echo "Deployment completed successfully!"
echo "Raw outputs: $DEPLOYMENT_OUTPUTS"

- name: Parse specific output values
env:
DEPLOYMENT_OUTPUTS: ${{ steps.stackql-deploy.outputs.deployment_outputs }}
run: |
WORKSPACE_NAME=$(echo "$DEPLOYMENT_OUTPUTS" | jq -r '.databricks_workspace_name // "N/A"')
WORKSPACE_ID=$(echo "$DEPLOYMENT_OUTPUTS" | jq -r '.databricks_workspace_id // "N/A"')
WORKSPACE_STATUS=$(echo "$DEPLOYMENT_OUTPUTS" | jq -r '.databricks_workspace_status // "N/A"')

echo "Workspace Name: $WORKSPACE_NAME"
echo "Workspace ID: $WORKSPACE_ID"
echo "Workspace Status: $WORKSPACE_STATUS"

# Add to GitHub Step Summary
echo "## Deployment Results" >> $GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Workspace Name | $WORKSPACE_NAME |" >> $GITHUB_STEP_SUMMARY
echo "| Workspace ID | $WORKSPACE_ID |" >> $GITHUB_STEP_SUMMARY
echo "| Workspace Status | $WORKSPACE_STATUS |" >> $GITHUB_STEP_SUMMARY

- name: Use outputs in another step
if: contains(steps.stackql-deploy.outputs.deployment_outputs, 'RUNNING')
run: |
echo "Workspace is running, proceeding with post-deployment tasks..."
# Add your post-deployment logic here

- name: Upload deployment outputs as artifact
uses: actions/upload-artifact@v4
with:
name: deployment-outputs
path: deployment-outputs.json # same value as output_file above
retention-days: 30

post-deploy:
needs: deploy
runs-on: ubuntu-latest
if: success()
steps:
- name: Download deployment outputs
uses: actions/download-artifact@v4
with:
name: deployment-outputs

- name: Process outputs in separate job
run: |
echo "Processing deployment outputs in a separate job..."
if [ -f "deployment-outputs.json" ]; then
cat deployment-outputs.json
# Process the outputs as needed
fi
```

Uploading the file as an artifact is an alternative to declaring job outputs (see [Sharing Outputs Between Jobs](#sharing-outputs-between-jobs)). The artifact remains downloadable after the run finishes and is not subject to the size limit on job outputs.

## Features

- **Automatic Summary**: When an output file is specified, the action automatically adds the JSON output to the GitHub Step Summary
Expand Down