CI Automation & JSON Output

Stallion CLI CI automation - Run every CLI command non-interactively with --ci-token and parse machine-readable results with --json in your release pipelines.

Available in stallion-cli@2.6.0-alpha.2:

The --json flag and CI support for the list commands are currently available in stallion-cli@2.6.0-alpha.2. Install it with:

npm install -g stallion-cli@2.6.0-alpha.2

Two flags make the Stallion CLI fully scriptable:

  • --ci-token — authenticates with a CI token instead of an interactive login session, so commands run headless in pipelines
  • --json — replaces the human-friendly output with a single machine-readable JSON result on stdout

Together they let you build end-to-end release automation: publish a bundle, promote it, ramp the rollout, and verify adoption — all from a CI job.

Generating a CI Token

Generate a CI token in the Stallion Console under: Project Settings > Access Tokens > Generate CI Token

Non-Interactive Usage with --ci-token

Interactive prompts (org pickers, project pickers, version pickers) are unavailable in CI, so each command requires enough flags to resolve everything up front:

CommandRequired with --ci-token
publish-bundle--upload-path, --platform
release-bundle--project-id, --hash, --app-version, --release-note
update-release--project-id, --hash
list-buckets--project-id
list-bundles--project-id, --bucket or --bucket-id
list-releases--project-id, --platform, --app-version
release-info--project-id, --platform, --app-version, --promoted-id
list-patches--project-id, --hash

Machine-Readable Output with --json

With --json, stdout carries only the JSON result — progress bars, spinners, and status messages are kept off it (diagnostics go to stderr). That means you can pipe the output straight into jq or capture it in a variable without any cleanup.

Output shapes:

{ "version": 12, "hash": "6c8a45…", "platform": "android", "uploadPath": "acme/my-project/featurebucket", "bucketCreated": false }
{ "id": "6650a2c1…", "version": 12, "appVersion": "1.0.1", "hash": "6c8a45…", "projectId": "64f5f341…" }
{ "projectId": "64f5f341…", "hash": "6c8a45…", "rolloutPercent": 50, "isMandatory": true, "isPaused": false, "isRolledBack": false }

The list commands (list-projects, list-buckets, list-bundles, list-releases, list-patches) print the raw array returned by the API, and release-info prints the full release detail object including adoption event counts.

Example: End-to-End Release Pipeline

#!/usr/bin/env bash
set -euo pipefail

CI_TOKEN="$STALLION_CI_TOKEN"
PROJECT_ID="64f5f341a43eb5ccf93548e4"

# 1. Publish the bundle and capture its hash
PUBLISH=$(stallion publish-bundle \
  --upload-path=acme/my-project/featurebucket \
  --platform=android \
  --release-note="$RELEASE_NOTE" \
  --ci-token="$CI_TOKEN" \
  --json)
HASH=$(echo "$PUBLISH" | jq -r '.hash')

# 2. Promote it to production at 0% rollout
stallion release-bundle \
  --project-id="$PROJECT_ID" \
  --hash="$HASH" \
  --app-version=1.0.1 \
  --release-note="$RELEASE_NOTE" \
  --ci-token="$CI_TOKEN" \
  --json

# 3. Ramp the rollout to 50%
stallion update-release \
  --project-id="$PROJECT_ID" \
  --hash="$HASH" \
  --rollout-percent=50 \
  --ci-token="$CI_TOKEN" \
  --json

Example: GitHub Actions Step

- name: Publish OTA update
  run: |
    HASH=$(stallion publish-bundle \
      --upload-path=acme/my-project/featurebucket \
      --platform=android \
      --release-note="${{ github.event.head_commit.message }}" \
      --ci-token="${{ secrets.STALLION_CI_TOKEN }}" \
      --json | jq -r '.hash')
    echo "BUNDLE_HASH=$HASH" >> "$GITHUB_ENV"

For a complete workflow, see Release Automation using GitHub Actions.