Skip to content

Commit d08b1df

Browse files
committed
Add initial Spice Cloud Deploy GitHub Action
Node 20 TypeScript action that deploys Spice.ai Cloud apps via the Management API using OAuth 2.0 client credentials, with optional post-deploy SQL/NSQL/search/chat/MCP smoke tests using the @spiceai/spice SDK. Includes action.yml, full deploy orchestration (resolve/create app, push spicepod, upsert secrets, trigger + poll deployment), regional runtime URL derivation, app tag merging, masked secrets, GitHub step summary, examples, CI matrix (Ubuntu/macOS/Windows), release workflow, and 61 unit tests.
1 parent 4ff600c commit d08b1df

45 files changed

Lines changed: 7031 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/** linguist-generated=true
2+
* text=auto eol=lf
3+
*.sh text eol=lf
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Bug report
2+
description: Report a problem with the Spice Cloud Deploy Action.
3+
labels: [bug]
4+
body:
5+
- type: textarea
6+
id: what-happened
7+
attributes:
8+
label: What happened?
9+
description: Describe the unexpected behavior, including the exact action version (`@v1`, `@v1.2.3`, etc.).
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: workflow
14+
attributes:
15+
label: Workflow snippet
16+
description: Paste the relevant `uses:` block (redact secrets).
17+
render: yaml
18+
- type: textarea
19+
id: logs
20+
attributes:
21+
label: Action logs
22+
description: Paste the failing job log (redact tokens, API keys, hostnames).
23+
render: text
24+
- type: input
25+
id: runner
26+
attributes:
27+
label: Runner
28+
placeholder: ubuntu-latest / self-hosted / etc.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Feature request
2+
description: Suggest an enhancement to the Spice Cloud Deploy Action.
3+
labels: [enhancement]
4+
body:
5+
- type: textarea
6+
id: problem
7+
attributes:
8+
label: Problem
9+
description: What workflow are you trying to build, and what's currently in the way?
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: proposal
14+
attributes:
15+
label: Proposal
16+
description: How would you like this to work? Include desired inputs/outputs if relevant.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Summary
2+
3+
<!-- What does this change do, and why? -->
4+
5+
## Checklist
6+
7+
- [ ] `npm run all` passes locally
8+
- [ ] `dist/index.js` is up to date (`npm run build`)
9+
- [ ] `CHANGELOG.md` updated under `## [Unreleased]`
10+
- [ ] Tests added or updated for behavior changes
11+
- [ ] Action inputs/outputs documented in `README.md` and `action.yml`

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10
8+
groups:
9+
production:
10+
dependency-type: production
11+
development:
12+
dependency-type: development
13+
- package-ecosystem: github-actions
14+
directory: "/"
15+
schedule:
16+
interval: weekly

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [trunk, main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: Lint, typecheck, test, build
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, macos-latest, windows-latest]
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
cache: npm
30+
31+
- run: npm ci
32+
33+
- run: npm run lint
34+
if: matrix.os == 'ubuntu-latest'
35+
36+
- run: npm run typecheck
37+
38+
- run: npm test
39+
40+
- run: npm run build
41+
42+
- name: Verify dist/ is in sync
43+
if: matrix.os == 'ubuntu-latest'
44+
shell: bash
45+
run: |
46+
if ! git diff --exit-code --quiet dist/; then
47+
echo "::error::dist/ is out of sync. Run 'npm run build' and commit the result."
48+
git --no-pager diff dist/ | head -100
49+
exit 1
50+
fi
51+
52+
audit:
53+
name: npm audit
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: actions/setup-node@v4
58+
with:
59+
node-version: 20
60+
cache: npm
61+
- run: npm ci
62+
- run: npm audit --omit=dev

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: npm
23+
24+
- run: npm ci
25+
26+
- name: Verify dist/ is committed
27+
shell: bash
28+
run: |
29+
npm run build
30+
if ! git diff --exit-code --quiet dist/; then
31+
echo "::error::dist/ is stale on this tag. Re-tag after running 'npm run build'."
32+
exit 1
33+
fi
34+
35+
- name: Move floating major-version tag
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
shell: bash
39+
run: |
40+
set -euo pipefail
41+
tag="${GITHUB_REF##*/}"
42+
major="${tag%%.*}"
43+
echo "Moving ${major} to ${tag}"
44+
git tag -f "${major}" "${tag}"
45+
git push --force origin "refs/tags/${major}"
46+
47+
- name: Create GitHub release
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
shell: bash
51+
run: |
52+
set -euo pipefail
53+
tag="${GITHUB_REF##*/}"
54+
notes_file="$(mktemp)"
55+
if [ -f CHANGELOG.md ]; then
56+
awk -v ver="${tag#v}" '
57+
/^## \[?'"${tag#v}"'\]?/ { capture=1; next }
58+
/^## / && capture { exit }
59+
capture { print }
60+
' CHANGELOG.md > "$notes_file"
61+
fi
62+
if [ ! -s "$notes_file" ]; then
63+
echo "Release ${tag}" > "$notes_file"
64+
fi
65+
gh release create "$tag" --title "$tag" --notes-file "$notes_file"

.github/workflows/test-action.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test action
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
app-name:
7+
description: Spice Cloud app name to deploy to.
8+
required: true
9+
region:
10+
description: Region for create-if-missing.
11+
default: us-west-2
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
smoke:
18+
runs-on: ubuntu-latest
19+
environment: spice-cloud
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Deploy + smoke test
24+
uses: ./
25+
with:
26+
client-id: ${{ secrets.SPICE_CLIENT_ID }}
27+
client-secret: ${{ secrets.SPICE_CLIENT_SECRET }}
28+
app-name: ${{ inputs.app-name }}
29+
region: ${{ inputs.region }}
30+
create-app-if-missing: true
31+
spicepod: examples/spicepod.yaml
32+
tags: |
33+
source=spice-cloud-deploy-action
34+
commit=${{ github.sha }}
35+
test-sql: SELECT 1
36+
test-warmup-seconds: 120

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
lib/
3+
coverage/
4+
.env
5+
.env.*
6+
!.env.example
7+
.DS_Store
8+
*.log
9+
.vscode/
10+
.idea/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

0 commit comments

Comments
 (0)