Reusable GitHub Actions that deploy apps to a self-hosted Komodo. Both use the
official komodo_client package and are self-healing:
they create the Komodo resources they need on first run, so nothing needs setting up by hand in the
UI.
Ensures a Komodo Build and Stack exist, builds the given branch, deploys the image. The Stack's
environment is prefixed with IMAGE_TAG=<build commit hash> (falling back to commit-sha, then
latest) — don't pass IMAGE_TAG yourself.
- id: deploy-context
run: node komodo/deploy-context.mjs
env:
REF: ${{ github.ref }}
SHA: ${{ github.sha }}
- uses: BrockCSC/komodo-deploy/deploy@v1
with:
komodo-host: ${{ vars.KOMODO_HOST }}
komodo-api-key: ${{ secrets.KOMODO_API_KEY }}
komodo-api-secret: ${{ secrets.KOMODO_API_SECRET }}
build-name: brockcsc
server: ${{ vars.KOMODO_SERVER }}
repo: BrockCSC/website
build-path: .
dockerfile-path: Dockerfile
image-name: brockcsc-ca
branch: ${{ steps.deploy-context.outputs.branch }}
stack-name: ${{ steps.deploy-context.outputs.stack-name }}
compose-file-paths: deploy/docker-compose.yml
environment: ${{ steps.deploy-context.outputs.environment }}
commit-sha: ${{ github.sha }}Most inputs map onto one field of the Komodo Build or Stack. Four — server, repo, branch
and git-provider — go to both.
| name | required | description |
|---|---|---|
komodo-host |
yes | Komodo API base URL |
komodo-api-key |
yes | |
komodo-api-secret |
yes | |
build-name |
yes | Komodo Build resource name (created if missing) |
server |
yes | Komodo Server name, used as both the Build's builder and Stack server |
repo |
yes | owner/name |
build-path |
yes | |
dockerfile-path |
yes | |
image-name |
yes | |
branch |
yes | Branch (or tag name) to build and deploy from |
stack-name |
yes | Komodo Stack resource name (created if missing) |
compose-file-paths |
yes | Comma-separated, e.g. deploy/docker-compose.yml |
environment |
yes | Multiline KEY=VALUE block for the Stack's environment (excluding IMAGE_TAG) |
git-provider |
no | Default github.com |
commit-sha |
no | Fallback image tag if the Build's commit hash isn't available |
Fixed by the action, not exposed: the Build sets include_commit_tag and clears the latest and
version tags; the Stack disables auto_pull and destroy_before_deploy. Both disable Komodo
webhooks, since the workflow is what triggers a deploy.
| name | description |
|---|---|
commit-hash |
Commit hash tagged on the built image |
The image is only published under its commit tag, so the compose file must be told which tag was just built. The action resolves that and prepends it to your environment block.
Read it back the usual way:
services:
app:
image: brockcsc-ca:${IMAGE_TAG}Everything else in the block passes through untouched.
Registers or updates a Komodo Action from a local script, for logic that must run inside Komodo —
reaching a private docker network CI runners can't, say. It only registers the script; it never runs
it.
- uses: BrockCSC/komodo-deploy/ensure-action@v1
with:
komodo-host: ${{ vars.KOMODO_HOST }}
komodo-api-key: ${{ secrets.KOMODO_API_KEY }}
komodo-api-secret: ${{ secrets.KOMODO_API_SECRET }}
action-name: brockcsc-preview-sweep
script-path: komodo/actions/preview-sweep.ts
schedule: "at 09:00 am"
schedule-enabled: true| name | required | description |
|---|---|---|
komodo-host |
yes | |
komodo-api-key |
yes | |
komodo-api-secret |
yes | |
action-name |
yes | Komodo Action resource name (created if missing) |
script-path |
yes | Path, in the caller's checkout, to the .ts file to upload |
schedule |
no | Komodo schedule string, e.g. at 09:00 am |
schedule-format |
no | Default English |
schedule-enabled |
no | Default false |
Neither action sends you to the Komodo UI: every Komodo log line is printed into the workflow run, grouped by stage, before the step exits non-zero.
See CONTRIBUTING.md.