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
What It Does
Section titled “What It Does”- Validates credentials - Checks organization and API key
- Authenticates Docker registry - Automatically logs you into Quant Cloud Image Registry
- Detects environment - Determines environment name based on branch/tag
- Checks existence - Verifies if app and environment already exist
- Generates image tags - Provides
image_suffixfor consistent tagging
Inputs
Section titled “Inputs”| 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 |
Outputs
Section titled “Outputs”| 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 |
Environment Detection Logic
Section titled “Environment Detection Logic”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 |
Basic Usage
Section titled “Basic Usage”- 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 }}With Custom Application Name
Section titled “With Custom Application Name”- 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-appUsing Image Suffix Output
Section titled “Using Image Suffix Output”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 }}Conditional Steps Based on Outputs
Section titled “Conditional Steps Based on Outputs”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:allComplete Example
Section titled “Complete Example”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 }}"Error Handling
Section titled “Error Handling”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
Tips & Best Practices
Section titled “Tips & Best Practices”- Store in secrets - Always use repository secrets for
quant_organizationandquant_api_key - Reference by ID - Use
idto reference outputs:steps.init.outputs.xxx - Check existence - Use
environment_existsto decide create vs update - Use suffix everywhere - Apply
image_suffixto all image tags for consistency - No manual login needed - Docker login is automatic, don’t add separate login steps
Next Steps
Section titled “Next Steps”- Compose Action - Translate docker-compose files
- Environment Action - Create/update environments
- Complete workflow examples