The deploy command enables you to deploy branches to specific target environments. It provides both interactive and non-interactive modes for initiating deployments.

Usage

cased deploy [--project PROJECT] [--branch BRANCH] [--target TARGET]

Options

  • --project: Specify the project name to deploy (optional if already set)
  • --branch: Specify the branch to deploy (optional)
  • --target: Specify the target environment for deployment (optional)

Interactive Mode

If you run cased deploy without the --branch or --target options, the CLI will enter interactive mode:

  1. The CLI will fetch and display a list of deployable branches
  2. You’ll be prompted to select a branch from the list
  3. After selecting a branch, you’ll be shown available target environments
  4. Select a target environment to initiate the deployment

Example interactive session:

Non-Interactive Mode

For automated workflows, you can specify all parameters directly:

cased deploy --branch feature/auth --target staging

Deployment Process

  1. Branch Validation: The CLI verifies that:

    • The branch exists
    • The branch is deployable
    • The branch has available target environments
  2. Target Validation: The system checks if:

    • The target environment is valid
    • The selected branch can be deployed to the chosen target
  3. Deployment Initiation: If all checks pass:

    • The deployment is initiated
    • A success message confirms the dispatch
    • The deployment process begins

Status Messages

  • Success: "Dispatch succeeded. Starting deployment..."
  • Failure: "Deployment dispatch failed. Please try again later."

Error Cases

The command will exit with an error if:

  • No deployable branches are found
  • No branch is selected
  • The selected branch is not deployable
  • No targets are available for the selected branch

Error messages will provide guidance on how to resolve the issue, including a link to the project dashboard for more details.

Examples

Basic Usage

# Interactive mode
cased deploy

# Non-interactive mode with all options
cased deploy --project my-project --branch feature/auth --target staging

# Using project from environment, specifying branch and target
cased deploy --branch main --target production

Common Workflows

  1. Development Deployment

    cased deploy --branch develop --target staging
    
  2. Production Release

    cased deploy --branch main --target production
    
  3. Feature Testing

    cased deploy --branch feature/new-feature --target staging
    

Best Practices

  1. Branch Selection

    • Ensure your branch is deployable before attempting deployment
    • Verify that all required checks have passed
    • Review the available targets for your branch
  2. Target Selection

    • Start with lower environments (staging) before production
    • Verify the target environment is appropriate for your changes
    • Ensure you have necessary permissions for the target environment
  3. Deployment Verification

    • Monitor the deployment progress after initiation
    • Check deployment status using cased deployments
    • Verify the application status in the target environment

Troubleshooting

If you encounter issues:

  1. Verify your project selection using cased projects
  2. Check branch status using cased branches
  3. Confirm available targets with cased targets
  4. Ensure you’re logged in with cased login
  5. Visit the project dashboard for detailed status information