Automating Releases with Stallion CLI
Learn how to use the Stallion CLI to publish, release, and manage app bundles.
Release Automation with Stallion CLI
The Stallion CLI simplifies the process of publishing, promoting, and managing application bundles for both Android and iOS platforms. This guide outlines the core commands and usage patterns.
Publishing a Bundle
To publish a bundle, run the following command:
stallion publish-bundle \
--upload-path=orgname/project-name/bucket-name \
--platform=android/ios \
--release-note="Your release note here"
Example
stallion publish-bundle \
--upload-path=my-org/my-project/my-bucket \
--platform=android \
--release-note="Initial release"
After a successful upload, you will receive a bundle hash. This hash is required for promoting the bundle.
Promoting a Bundle
To promote the published bundle, use the bundle hash from the previous step:
stallion release-bundle \
--project-id=<your_project_id> \
--hash=<bundle_hash> \
--app-version=<target_app_version> \
--release-note="Your release note" \
--ci-token=<your_ci_token>
Example
stallion release-bundle \
--project-id=64f5f341a43eb5ccf93548e4 \
--hash=6c8a45dcf5a3e983e389afada81449b2b326b2540758a55ca2227902a55f7e2a \
--app-version=1.0.1 \
--release-note="First test CI release" \
--ci-token=stl_zKNKb6JvW80DemZNomJF8EgxHo-KNcVo_u
Updating a Release
By default, a newly promoted bundle is rolled out to 0% of users. You can update the release to control rollout percentage, mark it as mandatory, pause, or even rollback.
stallion update-release \
--project-id=<your_project_id> \
--hash=<bundle_hash> \
--release-note="Updated release note" \
--rollout-percent=<percent> \
--is-mandatory=<true|false> \
--ci-token=<your_ci_token>
Example
stallion update-release \
--project-id=64f5f341a43eb5ccf93548e4 \
--hash=6c8a45dcf5a3e983e389afada81449b2b326b2540758a55ca2227902a55f7e2a \
--release-note="First test CI release" \
--rollout-percent=27 \
--is-mandatory=true \
--ci-token=stl_zKNKb6JvW80DemZNomJF8EgxHo
GitHub Actions Workflow
Here is a sample GitHub Actions workflow to automate publishing, promoting, and updating a Stallion bundle using the CLI:
name: Stallion Release Automation
on:
push:
branches:
- main # or your deployment branch
jobs:
release-bundle:
runs-on: ubuntu-latest
env:
PROJECT_ID: 64f5f341a43eb5ccf93548e4 #Save in env
APP_VERSION: 1.0.1
RELEASE_NOTE: "Automated CI Release"
CI_TOKEN: ${{ secrets.STALLION_CI_TOKEN }}
UPLOAD_PATH: my-org/my-project/my-bucket
PLATFORM: android
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js (if needed)
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Stallion CLI
run: npm install -g stallion-cli
- name: Publish Bundle and Extract Hash
id: publish
run: |
echo "Publishing bundle..."
OUTPUT=$(stallion publish-bundle \
--upload-path=$UPLOAD_PATH \
--platform=$PLATFORM \
--release-note="$RELEASE_NOTE")
echo "$OUTPUT"
HASH=$(echo "$OUTPUT" | grep -oE '[a-f0-9]{64}')
echo "Bundle hash: $HASH"
echo "BUNDLE_HASH=$HASH" >> $GITHUB_ENV
- name: Release Bundle
run: |
stallion release-bundle \
--project-id=$PROJECT_ID \
--hash=$BUNDLE_HASH \
--app-version=$APP_VERSION \
--release-note="$RELEASE_NOTE" \
--ci-token=$CI_TOKEN
- name: Update Release (optional rollout config)
run: |
stallion update-release \
--project-id=$PROJECT_ID \
--hash=$BUNDLE_HASH \
--release-note="$RELEASE_NOTE" \
--rollout-percent=100 \
--is-mandatory=true \
--ci-token=$CI_TOKEN
Make sure to set the
STALLION_CI_TOKEN
as a GitHub Secret for secure access.