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
InputRequiredDefaultDescription
quant_organizationYes-Quant Cloud organization name
quant_api_keyYes-Quant Cloud API key
quant_applicationNoRepository nameApplication name
master_branch_overrideNomain or masterOverride master branch
environment_name_overrideNoAuto-detectedOverride environment name
base_urlNoProduction APIQuant Cloud API base URL
OutputDescriptionExample
project_existsWhether app existstrue
environment_existsWhether environment existsfalse
quant_applicationDetermined app namemy-app
environment_nameDetermined environment nameproduction
is_productionIs production environmenttrue
stripped_endpointRegistry endpoint (no protocol)123456.dkr.ecr.us-east-1.amazonaws.com
image_suffixImage tag suffix with hyphen-latest
image_suffix_cleanImage tag suffix without hyphenlatest

The action automatically determines environments based on Git context:

Branch/TagEnvironmentImage Suffix
main / masterproduction-latest
developdevelop-develop
feature/new-thingfeature-new-thing-feature-new-thing
Pull Request #123pr-123-pr-123
Tag v1.0.0production-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