Skip to content

Init Action

The Init Action is the foundation of all Quant Cloud GitHub workflows. It handles authentication, registry login, environment detection, and provides essential outputs for subsequent steps.

Repository: quantcdn/quant-cloud-init-action

  1. Validates credentials - Checks organization and API key
  2. Authenticates Docker registry - Automatically logs you into Quant Cloud Image Registry
  3. Detects environment - Determines environment name based on branch/tag
  4. Checks existence - Verifies if app and environment already exist
  5. Generates image tags - Provides image_suffix for consistent tagging
Input Required Default Description
quant_organization Yes - Quant Cloud organization name
quant_api_key Yes - Quant Cloud API key
quant_application No Repository name Application name
master_branch_override No main or master Override master branch
environment_name_override No Auto-detected Override environment name
base_url No Production API Quant Cloud API base URL
Output Description Example
project_exists Whether app exists true
environment_exists Whether environment exists false
quant_application Determined app name my-app
environment_name Determined environment name production
is_production Is production environment true
stripped_endpoint Registry endpoint (no protocol) 123456.dkr.ecr.us-east-1.amazonaws.com
image_suffix Image tag suffix with hyphen -latest
image_suffix_clean Image tag suffix without hyphen latest

The action automatically determines environments based on Git context:

Branch/Tag Environment Image Suffix
main / master production -latest
develop develop -develop
feature/new-thing feature-new-thing -feature-new-thing
Pull Request #123 pr-123 -pr-123
Tag v1.0.0 production -v1.0.0
- name: Initialize Quant Cloud
uses: quantcdn/quant-cloud-init-action@v1
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
# Docker is now automatically logged in
- name: Build and push
run: |
docker build -t ${{ steps.init.outputs.stripped_endpoint }}/org/app${{ steps.init.outputs.image_suffix }} .
docker push ${{ steps.init.outputs.stripped_endpoint }}/org/app${{ steps.init.outputs.image_suffix }}
- uses: quantcdn/quant-cloud-init-action@v1
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_application: my-custom-app

The image_suffix output makes tagging consistent across your workflow:

- uses: quantcdn/quant-cloud-init-action@v1
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
# Build multiple images with consistent tags
- name: Build web image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application }}:web${{ steps.init.outputs.image_suffix }}
- name: Build worker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application }}:worker${{ steps.init.outputs.image_suffix }}

Use outputs to control workflow behavior:

- uses: quantcdn/quant-cloud-init-action@v1
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
# Create environment only if it doesn't exist
- name: Create environment
if: steps.init.outputs.environment_exists == 'false'
uses: quantcdn/quant-cloud-environment-action@v1
with:
operation: create
environment_name: ${{ steps.init.outputs.environment_name }}
# Skip expensive operations for non-production
- name: Run full test suite
if: steps.init.outputs.is_production == 'true'
run: npm run test:all
name: Deploy to Quant Cloud
on:
push:
branches: [main, develop, 'feature/**']
tags: ['v*']
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Initialize Quant Cloud
uses: quantcdn/quant-cloud-init-action@v1
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
# Docker login already handled by init!
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm64
tags: |
${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application }}${{ steps.init.outputs.image_suffix }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update environment
uses: quantcdn/quant-cloud-environment-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: ${{ secrets.QUANT_ORGANIZATION }}
app_name: ${{ steps.init.outputs.quant_application }}
environment_name: ${{ steps.init.outputs.environment_name }}
operation: update
- name: Deployment summary
run: |
echo "✅ Deployed to ${{ steps.init.outputs.environment_name }}"
echo "📦 Image: .../${{ steps.init.outputs.quant_application }}${{ steps.init.outputs.image_suffix }}"

The action fails early with clear messages if:

  • Organization doesn’t exist
  • API key is invalid
  • Registry credentials can’t be retrieved
  • Docker login fails
  1. Store in secrets - Always use repository secrets for quant_organization and quant_api_key
  2. Reference by ID - Use id to reference outputs: steps.init.outputs.xxx
  3. Check existence - Use environment_exists to decide create vs update
  4. Use suffix everywhere - Apply image_suffix to all image tags for consistency
  5. No manual login needed - Docker login is automatic, don’t add separate login steps